diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt index 925070d2e5..12c928eb63 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -77,10 +77,6 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ new global::TUnit.Core.InheritsTestsAttribute() ]; } - private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -94,10 +90,25 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ } } } -internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.AbstractTests.ConcreteClass2 CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt index bdc74075c7..483436fd31 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AfterTests_CleanupTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.AfterTests.CleanupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AfterTests.CleanupTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -91,14 +87,6 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource } } } -internal static class TUnit_TestProject_AfterTests_CleanupTests_Test1_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), new TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -149,7 +137,7 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AfterTests_CleanupTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -180,10 +168,6 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.AfterTests.CleanupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AfterTests.CleanupTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -196,11 +180,27 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource } } } -internal static class TUnit_TestProject_AfterTests_CleanupTests_Test2_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt index bdc74075c7..483436fd31 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AfterTests_CleanupTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.AfterTests.CleanupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AfterTests.CleanupTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -91,14 +87,6 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource } } } -internal static class TUnit_TestProject_AfterTests_CleanupTests_Test1_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), new TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -149,7 +137,7 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AfterTests_CleanupTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -180,10 +168,6 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.AfterTests.CleanupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AfterTests.CleanupTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -196,11 +180,27 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource } } } -internal static class TUnit_TestProject_AfterTests_CleanupTests_Test2_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt index ad73fa4b66..4ccbb25f45 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ArgsAsArrayTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -87,10 +87,6 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSo new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.ArgsAsArrayTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ArgsAsArrayTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -142,14 +138,6 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSo } } } -internal static class TUnit_TestProject_ArgsAsArrayTests_Params__string___ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgsAsArrayTests), new TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -212,7 +200,7 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnum Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ArgsAsArrayTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -243,10 +231,6 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnum new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.ArgsAsArrayTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ArgsAsArrayTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -298,14 +282,6 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnum } } } -internal static class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnumerable_string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgsAsArrayTests), new TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnumerable_string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -375,7 +351,7 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__i Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ArgsAsArrayTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -406,10 +382,6 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__i new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.ArgsAsArrayTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ArgsAsArrayTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -461,11 +433,28 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__i } } } -internal static class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__int_IEnumerable_string__ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt index 75ce270b40..f5cbfe8483 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt @@ -58,7 +58,7 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ArgumentWithImplicitConverterTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -90,10 +90,6 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ArgumentWithImplicitConverterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgumentWithImplicitConverterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -115,14 +111,6 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli } } } -internal static class TUnit_TestProject_ArgumentWithImplicitConverterTests_Explicit__ExplicitInteger_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), new TUnit_TestProject_ArgumentWithImplicitConverterTests_Explicit__ExplicitInteger_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -187,7 +175,7 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Impli Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ArgumentWithImplicitConverterTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -219,10 +207,6 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Impli new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ArgumentWithImplicitConverterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgumentWithImplicitConverterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -244,11 +228,27 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Impli } } } -internal static class TUnit_TestProject_ArgumentWithImplicitConverterTests_Implicit__ImplicitInteger_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 1a37a733f3..abf00eea2c 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,13 +68,24 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); + 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 + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } } @@ -116,10 +109,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +126,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,13 +162,23 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); + 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)); + } } } @@ -216,10 +202,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +219,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,12 +255,47 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt index 400b7ec8e6..03ebe9acb7 100644 --- a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt @@ -77,7 +77,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -109,10 +109,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -133,14 +129,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe } } } -internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_SingleValue__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_SingleValue__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -231,7 +219,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -263,10 +251,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -287,14 +271,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe } } } -internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Tuples__int_string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Tuples__int_string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -378,7 +354,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -410,10 +386,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -434,14 +406,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe } } } -internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Enumerable__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Enumerable__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -525,7 +489,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -557,10 +521,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -581,14 +541,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe } } } -internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Func__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Func__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -672,7 +624,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -704,10 +656,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -728,14 +676,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe } } } -internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_WithArguments__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_WithArguments__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -819,7 +759,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -851,10 +791,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -875,14 +811,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe } } } -internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_ExternalClass__string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_ExternalClass__string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -966,7 +894,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -998,10 +926,6 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1022,11 +946,32 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa } } } -internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTaskMethodDataSource_SingleValue__int_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt index 40b582e038..6c263c7b61 100644 --- a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AttributeTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -87,10 +87,6 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa {Property = "Foo",Property2 = 1,} ]; } - private static global::TUnit.TestProject.AttributeTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AttributeTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AttributeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -104,10 +100,25 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa } } } -internal static class TUnit_TestProject_AttributeTests_MyTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.AttributeTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AttributeTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AttributeTests), new TUnit_TestProject_AttributeTests_MyTest_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 c6cf4e515e..6ac3112a9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 1a37a733f3..abf00eea2c 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,13 +68,24 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); + 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 + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } } @@ -116,10 +109,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +126,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,13 +162,23 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); + 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)); + } } } @@ -216,10 +202,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +219,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,12 +255,47 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt index a2d297b54c..0b533e9d1f 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BeforeTests_SetupTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BeforeTests.SetupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BeforeTests.SetupTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -91,14 +87,6 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource } } } -internal static class TUnit_TestProject_BeforeTests_SetupTests_Test1_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), new TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -149,7 +137,7 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BeforeTests_SetupTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -180,10 +168,6 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BeforeTests.SetupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BeforeTests.SetupTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -196,11 +180,27 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource } } } -internal static class TUnit_TestProject_BeforeTests_SetupTests_Test2_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt index a2d297b54c..0b533e9d1f 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BeforeTests_SetupTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BeforeTests.SetupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BeforeTests.SetupTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -91,14 +87,6 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource } } } -internal static class TUnit_TestProject_BeforeTests_SetupTests_Test1_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), new TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -149,7 +137,7 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BeforeTests_SetupTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -180,10 +168,6 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BeforeTests.SetupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BeforeTests.SetupTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -196,11 +180,27 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource } } } -internal static class TUnit_TestProject_BeforeTests_SetupTests_Test2_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 1d02879131..63d613a210 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__2971_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -76,10 +76,6 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) ]; } - private static global::TUnit.TestProject.Bugs._2971.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2971.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -93,10 +89,25 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : } } } -internal static class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._2971.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2971.Tests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests_SimpleTest_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 1d02879131..63d613a210 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__2971_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -76,10 +76,6 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) ]; } - private static global::TUnit.TestProject.Bugs._2971.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2971.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -93,10 +89,25 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : } } } -internal static class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._2971.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2971.Tests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests_SimpleTest_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 1d02879131..63d613a210 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__2971_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -76,10 +76,6 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) ]; } - private static global::TUnit.TestProject.Bugs._2971.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2971.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -93,10 +89,25 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : } } } -internal static class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._2971.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2971.Tests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests_SimpleTest_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 86af5fe29b..c16b9fc4e1 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), TestMethodName = "SimpleTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -36,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2971", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2971", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._2971.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SimpleTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_Bugs__2971_Tests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -87,11 +68,46 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SimpleTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._2971.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2971.Tests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt index b1dd958e8d..ac151f5a5e 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassAndMethodArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -90,10 +90,6 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_Test new global::TUnit.Core.ArgumentsAttribute("2") ]; } - private static global::TUnit.TestProject.ClassAndMethodArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -106,14 +102,6 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_Test } } } -internal static class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), new TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -190,7 +178,7 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassAndMethodArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -223,10 +211,6 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL new global::TUnit.Core.ArgumentsAttribute("2") ]; } - private static global::TUnit.TestProject.ClassAndMethodArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -247,14 +231,6 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL } } } -internal static class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodLevel__string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), new TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodLevel__string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -331,7 +307,7 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParam Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassAndMethodArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -364,10 +340,6 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParam new global::TUnit.Core.ArgumentsAttribute("2") ]; } - private static global::TUnit.TestProject.ClassAndMethodArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -388,11 +360,28 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParam } } } -internal static class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParameters__string_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt index f01cce5b93..ef65d90552 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt @@ -66,7 +66,7 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassConstructorTest__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -98,11 +98,6 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g new global::TUnit.Core.ClassConstructorAttribute() ]; } - private static global::TUnit.TestProject.ClassConstructorTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - // ClassConstructor attribute is present - instance creation handled at runtime - throw new global::System.NotSupportedException("Instance creation for classes with ClassConstructor attribute is handled at runtime"); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassConstructorTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -116,10 +111,26 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g } } } -internal static class TUnit_TestProject_ClassConstructorTest_Test_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.ClassConstructorTest CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + // ClassConstructor attribute is present - instance creation handled at runtime + throw new global::System.NotSupportedException("Instance creation for classes with ClassConstructor attribute is handled at runtime"); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassConstructorTest), new TUnit_TestProject_ClassConstructorTest_Test_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt index d2183b4b62..27f82beb15 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -88,10 +88,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -113,14 +109,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class__SomeAsyncDisposableClass_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class__SomeAsyncDisposableClass_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -183,7 +171,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -215,10 +203,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -240,14 +224,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class_Generic__SomeAsyncDisposableClass_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class_Generic__SomeAsyncDisposableClass_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -310,7 +286,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -342,10 +318,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -366,14 +338,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_1_ClassDataSource__Ini_01E5B4B7_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_1_ClassDataSource__Ini_01E5B4B7_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -443,7 +407,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -475,10 +439,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -499,14 +459,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_2_ClassDataSources__In_52B92153_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_2_ClassDataSources__In_52B92153_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -583,7 +535,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -615,10 +567,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -639,14 +587,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_3_ClassDataSources__In_8432A34C_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_3_ClassDataSources__In_8432A34C_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -730,7 +670,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -762,10 +702,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -786,14 +722,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_4_ClassDataSources__In_159CD9D1_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_4_ClassDataSources__In_159CD9D1_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -884,7 +812,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -916,10 +844,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -940,11 +864,32 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_5_ClassDataSources__In_CB437346_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt index 95ce8e90e4..2b19ff177e 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests2__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -91,10 +91,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived new global::TUnit.Core.ClassDataSourceAttribute() ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTests2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -108,14 +104,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived1_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), new TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived1_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -179,7 +167,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests2__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -213,10 +201,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived new global::TUnit.Core.ClassDataSourceAttribute() ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTests2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -230,11 +214,27 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived2_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt index aa697afc83..697959e9c7 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -89,10 +89,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -114,14 +110,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class__SomeAsyncDis_82F9A818_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), new TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class__SomeAsyncDis_82F9A818_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -185,7 +173,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -217,10 +205,6 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -242,11 +226,27 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da } } } -internal static class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class_Generic__Some_7FC73642_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt index ef6dac42c1..8b17b5324f 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt @@ -334,7 +334,7 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ClassTupleDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -368,16 +368,6 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") ]; } - private static global::TUnit.TestProject.ClassTupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])) - { - Property1 = default(global::System.ValueTuple), - Property2 = default(global::System.ValueTuple), - Property3 = default(global::System.ValueTuple), - Property4 = default(global::System.ValueTuple), - }; - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -399,10 +389,31 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour } } } -internal static class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.ClassTupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])) + { + Property1 = default(global::System.ValueTuple), + Property2 = default(global::System.ValueTuple), + Property3 = default(global::System.ValueTuple), + Property4 = default(global::System.ValueTuple), + }; + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), new TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt index 925070d2e5..12c928eb63 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -77,10 +77,6 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ new global::TUnit.Core.InheritsTestsAttribute() ]; } - private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -94,10 +90,25 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ } } } -internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.AbstractTests.ConcreteClass2 CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_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 c6cf4e515e..6ac3112a9b 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 @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 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 @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 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 @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 1a37a733f3..abf00eea2c 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 @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,13 +68,24 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); + 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 + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } } @@ -116,10 +109,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +126,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,13 +162,23 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); + 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)); + } } } @@ -216,10 +202,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +219,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,12 +255,47 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 51e0a0b0a8..fefe151725 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 @@ -58,7 +58,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -90,10 +90,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -115,14 +111,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T } } } -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -194,7 +182,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -226,10 +214,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -251,14 +235,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s } } } -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -323,7 +299,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -355,10 +331,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -380,14 +352,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test } } } -internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -450,7 +414,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -482,10 +446,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -507,14 +467,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS } } } -internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -577,7 +529,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -609,10 +561,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -634,14 +582,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes } } } -internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -704,7 +644,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -736,10 +676,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -761,14 +697,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ } } } -internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -833,7 +761,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -865,10 +793,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -890,14 +814,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes } } } -internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -960,7 +876,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -992,10 +908,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1017,14 +929,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : } } } -internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1087,7 +991,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1119,10 +1023,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1144,14 +1044,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test } } } -internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1214,7 +1106,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1246,10 +1138,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1271,11 +1159,35 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou } } } -internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 51e0a0b0a8..fefe151725 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 @@ -58,7 +58,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -90,10 +90,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -115,14 +111,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T } } } -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -194,7 +182,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -226,10 +214,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -251,14 +235,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s } } } -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -323,7 +299,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -355,10 +331,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -380,14 +352,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test } } } -internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -450,7 +414,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -482,10 +446,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -507,14 +467,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS } } } -internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -577,7 +529,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -609,10 +561,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -634,14 +582,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes } } } -internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -704,7 +644,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -736,10 +676,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -761,14 +697,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ } } } -internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -833,7 +761,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -865,10 +793,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -890,14 +814,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes } } } -internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -960,7 +876,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -992,10 +908,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1017,14 +929,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : } } } -internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1087,7 +991,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1119,10 +1023,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1144,14 +1044,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test } } } -internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1214,7 +1106,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1246,10 +1138,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1271,11 +1159,35 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou } } } -internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 51e0a0b0a8..fefe151725 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 @@ -58,7 +58,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -90,10 +90,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -115,14 +111,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T } } } -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -194,7 +182,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -226,10 +214,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -251,14 +235,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s } } } -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -323,7 +299,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -355,10 +331,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -380,14 +352,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test } } } -internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -450,7 +414,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -482,10 +446,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -507,14 +467,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS } } } -internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -577,7 +529,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -609,10 +561,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -634,14 +582,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes } } } -internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -704,7 +644,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -736,10 +676,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -761,14 +697,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ } } } -internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -833,7 +761,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -865,10 +793,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -890,14 +814,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes } } } -internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -960,7 +876,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -992,10 +908,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1017,14 +929,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : } } } -internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1087,7 +991,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1119,10 +1023,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1144,14 +1044,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test } } } -internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1214,7 +1106,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1246,10 +1138,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1271,11 +1159,35 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou } } } -internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 a342948bb1..902751d49e 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 @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -50,43 +46,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -109,13 +82,33 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Materializer = GetTests }; } -} -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); + 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)); + } } } @@ -139,11 +132,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -181,43 +170,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -240,13 +206,33 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Materializer = GetTests }; } -} -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); + 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)); + } } } @@ -270,11 +256,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -305,43 +287,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -364,13 +323,33 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Materializer = GetTests }; } -} -internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); + 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)); + } } } @@ -394,11 +373,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -427,43 +402,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -486,13 +438,33 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Materializer = GetTests }; } -} -internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); + 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)); + } } } @@ -516,11 +488,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -549,43 +517,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -608,13 +553,33 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Materializer = GetTests }; } -} -internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); + 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.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)); + } } } @@ -638,11 +603,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NonEmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), @@ -671,43 +632,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -730,13 +668,33 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Materializer = GetTests }; } -} -internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); + 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.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)); + } } } @@ -760,11 +718,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -795,43 +749,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -854,13 +785,33 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Materializer = GetTests }; } -} -internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); + 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)); + } } } @@ -884,11 +835,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -917,43 +864,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -976,13 +900,33 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); + 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)); + } } } @@ -1006,11 +950,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -1039,43 +979,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1098,13 +1015,33 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Materializer = GetTests }; } -} -internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); + 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)); + } } } @@ -1128,11 +1065,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1161,43 +1094,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1220,12 +1130,64 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.Net4_7.verified.txt index 5be7810cdf..7212e2a8eb 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.Net4_7.verified.txt @@ -34,20 +34,16 @@ internal static class TUnit_TestProject_BeforeTests_Base1_BeforeAll1_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), - Name = "Base1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), + Name = "Base1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -105,20 +101,16 @@ internal static class TUnit_TestProject_BeforeTests_Base1_BeforeEach1_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), - Name = "Base1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), + Name = "Base1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -174,20 +166,16 @@ internal static class TUnit_TestProject_BeforeTests_Base2_BeforeAll2_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), - Name = "Base2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), + Name = "Base2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -245,20 +233,16 @@ internal static class TUnit_TestProject_BeforeTests_Base2_BeforeEach2_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), - Name = "Base2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), + Name = "Base2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -314,20 +298,16 @@ internal static class TUnit_TestProject_BeforeTests_Base3_BeforeAll3_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), - Name = "Base3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), + Name = "Base3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -385,20 +365,16 @@ internal static class TUnit_TestProject_BeforeTests_Base3_BeforeEach3_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), - Name = "Base3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), + Name = "Base3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -454,20 +430,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUp_Be ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -533,20 +505,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUpWit ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.ClassHookContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -612,20 +580,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUp__C ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -698,20 +662,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUpWit ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -769,20 +729,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_Setup_Before_Test ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -848,20 +804,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_Setup__Cancellati ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -927,20 +879,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_SetupWithContext_ ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -1013,20 +961,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_SetupWithContext_ ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt index e7e4b8f9ea..8c828247e0 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 @@ -70,7 +70,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -102,10 +102,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -126,14 +122,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -217,7 +205,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -249,10 +237,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -273,14 +257,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -357,7 +333,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -389,10 +365,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -413,14 +385,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -490,7 +454,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -522,10 +486,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -546,14 +506,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo } } } -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -623,7 +575,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -655,10 +607,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -679,14 +627,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b } } } -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -756,7 +696,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -788,10 +728,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -812,14 +748,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te } } } -internal static class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -889,7 +817,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -921,10 +849,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -945,14 +869,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix } } } -internal static class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1015,7 +931,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1047,10 +963,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1071,14 +983,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method1__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1141,7 +1045,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1173,10 +1077,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1197,14 +1097,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1267,7 +1159,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1299,10 +1191,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1323,14 +1211,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1393,7 +1273,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1425,10 +1305,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1449,14 +1325,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1526,7 +1394,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1561,10 +1429,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1585,14 +1449,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc } } } -internal static class TUnit_TestProject_MatrixTests_Exclusion__int_int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1662,7 +1518,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1694,10 +1550,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1718,11 +1570,38 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet } } } -internal static class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 e7e4b8f9ea..8c828247e0 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 @@ -70,7 +70,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -102,10 +102,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -126,14 +122,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -217,7 +205,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -249,10 +237,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -273,14 +257,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -357,7 +333,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -389,10 +365,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -413,14 +385,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -490,7 +454,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -522,10 +486,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -546,14 +506,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo } } } -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -623,7 +575,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -655,10 +607,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -679,14 +627,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b } } } -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -756,7 +696,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -788,10 +728,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -812,14 +748,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te } } } -internal static class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -889,7 +817,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -921,10 +849,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -945,14 +869,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix } } } -internal static class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1015,7 +931,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1047,10 +963,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1071,14 +983,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method1__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1141,7 +1045,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1173,10 +1077,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1197,14 +1097,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1267,7 +1159,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1299,10 +1191,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1323,14 +1211,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1393,7 +1273,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1425,10 +1305,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1449,14 +1325,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1526,7 +1394,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1561,10 +1429,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1585,14 +1449,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc } } } -internal static class TUnit_TestProject_MatrixTests_Exclusion__int_int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1662,7 +1518,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1694,10 +1550,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1718,11 +1570,38 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet } } } -internal static class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 e7e4b8f9ea..8c828247e0 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 @@ -70,7 +70,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -102,10 +102,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -126,14 +122,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -217,7 +205,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -249,10 +237,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -273,14 +257,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -357,7 +333,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -389,10 +365,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -413,14 +385,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -490,7 +454,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -522,10 +486,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -546,14 +506,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo } } } -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -623,7 +575,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -655,10 +607,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -679,14 +627,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b } } } -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -756,7 +696,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -788,10 +728,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -812,14 +748,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te } } } -internal static class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -889,7 +817,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -921,10 +849,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -945,14 +869,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix } } } -internal static class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1015,7 +931,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1047,10 +963,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1071,14 +983,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method1__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1141,7 +1045,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1173,10 +1077,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1197,14 +1097,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1267,7 +1159,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1299,10 +1191,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1323,14 +1211,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1393,7 +1273,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1425,10 +1305,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1449,14 +1325,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1526,7 +1394,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1561,10 +1429,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1585,14 +1449,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc } } } -internal static class TUnit_TestProject_MatrixTests_Exclusion__int_int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1662,7 +1518,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1694,10 +1550,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1718,11 +1570,38 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet } } } -internal static class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 664d214195..a140988e92 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 @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -62,42 +58,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -120,13 +94,32 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); + 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)); + } } } @@ -150,11 +143,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -204,42 +193,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -262,13 +229,32 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); + 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)); + } } } @@ -292,11 +278,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -339,42 +321,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -397,13 +357,32 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); + 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)); + } } } @@ -427,11 +406,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -467,42 +442,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -525,13 +478,32 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); + 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)); + } } } @@ -555,11 +527,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -595,42 +563,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -653,13 +599,32 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); + 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)); + } } } @@ -683,11 +648,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -723,42 +684,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -781,13 +720,32 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); + 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)); + } } } @@ -811,11 +769,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -851,42 +805,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -909,13 +841,32 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); + 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)); + } } } @@ -939,11 +890,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -972,42 +919,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1030,13 +955,32 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_Method1__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); + 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)); + } } } @@ -1060,11 +1004,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1093,42 +1033,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1151,13 +1069,32 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); + 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]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } } @@ -1181,11 +1118,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1214,42 +1147,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1272,13 +1183,32 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); + 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)); + } } } @@ -1302,11 +1232,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1335,42 +1261,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1393,13 +1297,32 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); + 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)); + } } } @@ -1423,14 +1346,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MatrixExclusionAttribute(1, 1), - new global::TUnit.Core.MatrixExclusionAttribute(2, 2), - new global::TUnit.Core.MatrixExclusionAttribute(3, 3), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1466,42 +1382,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.Exclusion(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1524,13 +1418,35 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MatrixTests_Exclusion__int_int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); + 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)); + } } } @@ -1554,11 +1470,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1594,42 +1506,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1652,12 +1542,66 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 7dca1eaf68..1086e4d1c1 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 @@ -67,7 +67,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -99,10 +99,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -124,14 +120,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -205,7 +193,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -237,10 +225,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -262,14 +246,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -343,7 +319,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -375,10 +351,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -400,14 +372,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -496,7 +460,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -528,10 +492,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -553,14 +513,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -676,7 +628,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -708,10 +660,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -733,14 +681,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -814,7 +754,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -846,10 +786,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -871,14 +807,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -962,7 +890,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -994,10 +922,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1018,11 +942,32 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 7dca1eaf68..1086e4d1c1 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 @@ -67,7 +67,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -99,10 +99,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -124,14 +120,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -205,7 +193,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -237,10 +225,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -262,14 +246,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -343,7 +319,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -375,10 +351,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -400,14 +372,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -496,7 +460,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -528,10 +492,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -553,14 +513,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -676,7 +628,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -708,10 +660,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -733,14 +681,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -814,7 +754,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -846,10 +786,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -871,14 +807,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -962,7 +890,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -994,10 +922,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1018,11 +942,32 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 7dca1eaf68..1086e4d1c1 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 @@ -67,7 +67,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -99,10 +99,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -124,14 +120,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -205,7 +193,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -237,10 +225,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -262,14 +246,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -343,7 +319,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -375,10 +351,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -400,14 +372,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -496,7 +460,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -528,10 +492,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -553,14 +513,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -676,7 +628,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -708,10 +660,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -733,14 +681,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -814,7 +754,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -846,10 +786,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -871,14 +807,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -962,7 +890,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -994,10 +922,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1018,11 +942,32 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c265ac1e49..015f7286d9 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 @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -59,43 +55,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + 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 = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -118,13 +91,33 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); + 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)); + } } } @@ -148,11 +141,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -192,43 +181,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + 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 = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -251,13 +217,33 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); + 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)); + } } } @@ -281,11 +267,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -325,43 +307,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + 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 = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -384,13 +343,33 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); + 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)); + } } } @@ -414,11 +393,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -473,43 +448,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + 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 = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -532,13 +484,33 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); + 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)); + } } } @@ -562,11 +534,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -648,43 +616,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + 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 = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -707,13 +652,33 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); + 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)); + } } } @@ -737,11 +702,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -781,43 +742,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + 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 = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -840,13 +778,33 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Materializer = GetTests }; } -} -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); + 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)); + } } } @@ -870,11 +828,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -924,42 +878,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + 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 = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -982,12 +914,60 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 b922af14dc..dec1759c85 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 @@ -81,7 +81,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -113,10 +113,6 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.TupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -138,10 +134,25 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu } } } -internal static class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_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 b922af14dc..dec1759c85 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 @@ -81,7 +81,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -113,10 +113,6 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.TupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -138,10 +134,25 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu } } } -internal static class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_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 b922af14dc..dec1759c85 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 @@ -81,7 +81,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -113,10 +113,6 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.TupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -138,10 +134,25 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu } } } -internal static class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_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 b647e7abe2..acd322552d 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 @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -73,43 +69,20 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), - Name = "TupleDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "TupleDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.TupleDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -132,11 +105,54 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt index acc8268ef8..bdf5acaee6 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_String1__string_T Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -88,10 +88,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_String1__string_T new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConstantArgumentsTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -112,14 +108,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_String1__string_T } } } -internal static class TUnit_TestProject_ConstantArgumentsTests_String1__string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_String1__string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -182,7 +170,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSour Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -214,10 +202,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSour new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConstantArgumentsTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -238,14 +222,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSour } } } -internal static class TUnit_TestProject_ConstantArgumentsTests_Int__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -308,7 +284,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Double__double_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -340,10 +316,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Double__double_Te new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConstantArgumentsTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -364,14 +336,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Double__double_Te } } } -internal static class TUnit_TestProject_ConstantArgumentsTests_Double__double_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_Double__double_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -434,7 +398,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Float__float_Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -466,10 +430,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Float__float_Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConstantArgumentsTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -490,14 +450,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Float__float_Test } } } -internal static class TUnit_TestProject_ConstantArgumentsTests_Float__float_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_Float__float_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -560,7 +512,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -592,10 +544,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSo new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConstantArgumentsTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -616,14 +564,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSo } } } -internal static class TUnit_TestProject_ConstantArgumentsTests_Long__long_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -686,7 +626,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -718,10 +658,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSo new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConstantArgumentsTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -742,14 +678,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSo } } } -internal static class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -812,7 +740,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -844,10 +772,6 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConstantArgumentsTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -868,11 +792,32 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test } } } -internal static class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.ConstantArgumentsTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstantArgumentsTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt index f43f14f1b9..9b70d3dd0b 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -88,10 +88,6 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -112,10 +108,25 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some } } } -internal static class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_SomeTest__string_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt index 7a0f365e7e..47aca73943 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -88,10 +88,6 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -112,10 +108,25 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString } } } -internal static class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests_SomeTest__string_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } diff --git a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt index 4693907195..d4de91837e 100644 --- a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -90,10 +90,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test_TestSource : new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -106,14 +102,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test_TestSource : } } } -internal static class TUnit_TestProject_CustomDisplayNameTests_Test_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_Test_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -177,7 +165,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -210,10 +198,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -226,14 +210,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource } } } -internal static class TUnit_TestProject_CustomDisplayNameTests_Test2_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -324,7 +300,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -357,10 +333,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -381,14 +353,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int } } } -internal static class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_Test3__string_int_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -475,7 +439,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceT Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -508,10 +472,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceT new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -532,14 +492,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceT } } } -internal static class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceTest__string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceTest__string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -624,7 +576,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_TestParameterName Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -657,10 +609,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_TestParameterName new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -681,14 +629,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_TestParameterName } } } -internal static class TUnit_TestProject_CustomDisplayNameTests_TestParameterNamePrefixBug__int_string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_TestParameterNamePrefixBug__int_string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -764,7 +704,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__str Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -796,10 +736,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__str new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -820,14 +756,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__str } } } -internal static class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_PasswordTest__string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -891,7 +819,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_SameClassConstant Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -924,10 +852,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_SameClassConstant new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -940,14 +864,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_SameClassConstant } } } -internal static class TUnit_TestProject_CustomDisplayNameTests_SameClassConstantTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_SameClassConstantTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1011,7 +927,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_DifferentClassCon Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1044,10 +960,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_DifferentClassCon new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1060,14 +972,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_DifferentClassCon } } } -internal static class TUnit_TestProject_CustomDisplayNameTests_DifferentClassConstantTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_DifferentClassConstantTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1131,7 +1035,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_NestedClassConsta Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1164,10 +1068,6 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_NestedClassConsta new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1180,11 +1080,34 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_NestedClassConsta } } } -internal static class TUnit_TestProject_CustomDisplayNameTests_NestedClassConstantTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt index 51e0a0b0a8..fefe151725 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt @@ -58,7 +58,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -90,10 +90,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -115,14 +111,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T } } } -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -194,7 +182,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -226,10 +214,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -251,14 +235,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s } } } -internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -323,7 +299,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -355,10 +331,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -380,14 +352,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test } } } -internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -450,7 +414,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -482,10 +446,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -507,14 +467,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS } } } -internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -577,7 +529,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -609,10 +561,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -634,14 +582,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes } } } -internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -704,7 +644,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -736,10 +676,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -761,14 +697,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ } } } -internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -833,7 +761,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -865,10 +793,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -890,14 +814,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes } } } -internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -960,7 +876,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -992,10 +908,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1017,14 +929,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : } } } -internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1087,7 +991,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1119,10 +1023,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1144,14 +1044,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test } } } -internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1214,7 +1106,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1246,10 +1138,6 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1271,11 +1159,35 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou } } } -internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt index 3d9411b9bf..8ebbf56657 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt @@ -138,7 +138,7 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -173,10 +173,6 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") ]; } - private static global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -198,10 +194,25 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet } } } -internal static class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod_DataSourceClassCombinedW_3C180E22_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + 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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), new TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod_DataSourceClassCombinedW_3C180E22_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt index 0a26a9a4c1..c39a30e599 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt @@ -83,7 +83,7 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataSourceGeneratorTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -117,10 +117,6 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() ]; } - private static global::TUnit.TestProject.DataSourceGeneratorTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataSourceGeneratorTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -142,14 +138,6 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M } } } -internal static class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), new TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -253,7 +241,7 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataSourceGeneratorTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -287,10 +275,6 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() ]; } - private static global::TUnit.TestProject.DataSourceGeneratorTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataSourceGeneratorTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -312,14 +296,6 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M } } } -internal static class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method2__int_string_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), new TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method2__int_string_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -423,7 +399,7 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DataSourceGeneratorTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -457,10 +433,6 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() ]; } - private static global::TUnit.TestProject.DataSourceGeneratorTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataSourceGeneratorTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -482,11 +454,28 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M } } } -internal static class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method3__int_string_bool_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt index af8d2dde34..1a48cca7c5 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt @@ -77,7 +77,7 @@ internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_b Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AutoDataTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -108,10 +108,6 @@ internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_b new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.AutoDataTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AutoDataTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AutoDataTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -132,10 +128,25 @@ internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_b } } } -internal static class TUnit_TestProject_AutoDataTests_Test1__string_int_double_bool_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.AutoDataTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AutoDataTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AutoDataTests), new TUnit_TestProject_AutoDataTests_Test1__string_int_double_bool_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt index c514c5cef7..3d5f359ea7 100644 --- a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt @@ -65,7 +65,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_d Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -97,10 +97,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_d new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -121,14 +117,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_d } } } -internal static class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -191,7 +179,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__deci Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -223,10 +211,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__deci new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -247,14 +231,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__deci } } } -internal static class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -317,7 +293,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decim Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -349,10 +325,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decim new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -373,14 +345,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decim } } } -internal static class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -443,7 +407,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -475,10 +439,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -499,14 +459,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal } } } -internal static class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -569,7 +521,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -601,10 +553,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -625,14 +573,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal } } } -internal static class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -695,7 +635,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -727,10 +667,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -751,14 +687,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValu } } } -internal static class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValue__decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValue__decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -835,7 +763,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__d Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -867,10 +795,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__d new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -891,14 +815,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__d } } } -internal static class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__decimal_decimal_decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__decimal_decimal_decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -963,7 +879,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -995,10 +911,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1020,14 +932,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestS } } } -internal static class TUnit_TestProject_DecimalArgumentTests_Test__decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1127,7 +1031,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TransactionDiscount Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1159,10 +1063,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TransactionDiscount new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1184,14 +1084,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TransactionDiscount } } } -internal static class TUnit_TestProject_DecimalArgumentTests_TransactionDiscountCalculations__decimal_decima_54FB9799_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_TransactionDiscountCalculations__decimal_decima_54FB9799_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1254,7 +1146,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1286,10 +1178,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1310,14 +1198,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ } } } -internal static class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1380,7 +1260,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1412,10 +1292,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1436,14 +1312,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ } } } -internal static class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1506,7 +1374,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1538,10 +1406,6 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1562,11 +1426,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal } } } -internal static class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 c6cf4e515e..6ac3112a9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -181,10 +169,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -197,14 +181,6 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : } } } -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -255,7 +231,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -286,10 +262,6 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -302,11 +274,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes } } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 1a37a733f3..abf00eea2c 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,13 +68,24 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); + 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 + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } } @@ -116,10 +109,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +126,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,13 +162,23 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); + 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)); + } } } @@ -216,10 +202,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +219,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,12 +255,47 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt index 5b3f479b68..81f0807c25 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt @@ -58,7 +58,7 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -90,10 +90,6 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -115,10 +111,25 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest } } } -internal static class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest__string_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt index bc311d5d85..0b6872f8b3 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt @@ -77,7 +77,7 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_EnumerableDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -109,10 +109,6 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.EnumerableDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -133,14 +129,6 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour } } } -internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), new TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -224,7 +212,7 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_EnumerableDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -256,10 +244,6 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.EnumerableDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -280,14 +264,6 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour } } } -internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), new TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -371,7 +347,7 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_EnumerableDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -403,10 +379,6 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.EnumerableDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -428,11 +400,28 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour } } } -internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt index 00a1b2fd97..05c7b64643 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt @@ -113,7 +113,7 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -145,10 +145,6 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -170,10 +166,25 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat } } } -internal static class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), new TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt index a1c4df4cab..22498b6753 100644 --- a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt @@ -75,7 +75,7 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ExpectedArgumentTypeTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -107,10 +107,6 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ExpectedArgumentTypeTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ExpectedArgumentTypeTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ExpectedArgumentTypeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -131,14 +127,6 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments } } } -internal static class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments__object_Type_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), new TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments__object_Type_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -222,7 +210,7 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__obj Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ExpectedArgumentTypeTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -254,10 +242,6 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__obj new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.ExpectedArgumentTypeTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ExpectedArgumentTypeTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ExpectedArgumentTypeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -278,11 +262,27 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__obj } } } -internal static class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__object_Type_Type_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 81c0e901f7..7d1cc5fe8c 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_SimpleTestClass__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSourc new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.SimpleTestClass __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.SimpleTestClass(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.SimpleTestClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,10 +88,25 @@ internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSourc } } } -internal static class TUnit_TestProject_SimpleTestClass_NonGenericTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.SimpleTestClass CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.SimpleTestClass(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.SimpleTestClass), new TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt index d4649937f3..864a6b4446 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1589_MyTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -91,10 +91,6 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl {Shared = global::TUnit.Core.SharedType.None,} ]; } - private static global::TUnit.TestProject.Bugs._1589.MyTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1589.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1589.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -107,10 +103,25 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl } } } -internal static class TUnit_TestProject_Bugs__1589_MyTests_Test1_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + 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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1589.MyTests), new TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt index 5a987b317f..81d5a1667c 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1594_MyTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -91,10 +91,6 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl {Shared = global::TUnit.Core.SharedType.None,} ]; } - private static global::TUnit.TestProject.Bugs._1594.MyTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1594.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1594.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -108,10 +104,25 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl } } } -internal static class TUnit_TestProject_Bugs__1594_MyTests_Test1_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + 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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1594.MyTests), new TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt index 4018692264..b3e47633e0 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt @@ -298,7 +298,7 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_PropertySetterTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -331,19 +331,6 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") ]; } - private static global::TUnit.TestProject.PropertySetterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.PropertySetterTests() - { - Property1 = default!, - Property2 = default!, - Property3 = default!, - Property4 = default!, - Property5 = default!, - Property6 = default!, - Property7 = default!, - }; - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -356,10 +343,34 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl } } } -internal static class TUnit_TestProject_PropertySetterTests_Test_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.PropertySetterTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PropertySetterTests() + { + Property1 = default!, + Property2 = default!, + Property3 = default!, + Property4 = default!, + Property5 = default!, + Property6 = default!, + Property7 = default!, + }; + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PropertySetterTests), new TUnit_TestProject_PropertySetterTests_Test_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt index d93937fb6e..096bbe2ef4 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_InheritedTestsFromDifferentProjectTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -78,10 +78,6 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") ]; } - private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -95,14 +91,6 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ } } } -internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_Test_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests_Test_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -165,7 +153,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_InheritedTestsFromDifferentProjectTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -199,10 +187,6 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") ]; } - private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -224,14 +208,6 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ } } } -internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_GenericMethodDataSource__string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests_GenericMethodDataSource__string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -305,7 +281,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_InheritedTestsFromDifferentProjectTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -339,10 +315,6 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") ]; } - private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -364,14 +336,6 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ } } } -internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_NonGenericMethodDataSource__string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests_NonGenericMethodDataSource__string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -422,7 +386,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_InheritedTestsFromDifferentProjectTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -456,10 +420,6 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") ]; } - private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -472,11 +432,29 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ } } } -internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_VerifyInheritedCategoriesAreAvailable_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt index 925070d2e5..12c928eb63 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -77,10 +77,6 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ new global::TUnit.Core.InheritsTestsAttribute() ]; } - private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -94,10 +90,25 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ } } } -internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.AbstractTests.ConcreteClass2 CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt index 3f4bea97cb..a8e551db53 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt @@ -102,7 +102,7 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1924_None_BaseClass__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -135,13 +135,6 @@ 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::TUnit.TestProject.Bugs._1924.None.BaseClass __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1924.None.BaseClass() - { - Data = default!, - }; - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1924.None.BaseClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -162,10 +155,28 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test } } } -internal static class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + 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() + { + Data = default!, + }; + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } diff --git a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt index 84bcebdc4f..ade96ae30a 100644 --- a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt @@ -53,7 +53,7 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__Issue2887_ActualTestClass__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -85,11 +85,6 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te new global::TUnit.Core.ClassConstructorAttribute() ]; } - private static global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - // ClassConstructor attribute is present - instance creation handled at runtime - throw new global::System.NotSupportedException("Instance creation for classes with ClassConstructor attribute is handled at runtime"); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -103,10 +98,26 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te } } } -internal static class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + // ClassConstructor attribute is present - instance creation handled at runtime + throw new global::System.NotSupportedException("Instance creation for classes with ClassConstructor attribute is handled at runtime"); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), new TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt index 9fbb5c70b1..59d87cef94 100644 --- a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt @@ -70,7 +70,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -102,10 +102,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -126,14 +122,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -217,7 +205,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -249,10 +237,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -273,14 +257,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -357,7 +333,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -389,10 +365,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -413,14 +385,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu } } } -internal static class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -490,7 +454,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -522,10 +486,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -546,14 +506,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo } } } -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -623,7 +575,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -655,10 +607,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -679,14 +627,6 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b } } } -internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -756,7 +696,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -788,10 +728,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -812,14 +748,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te } } } -internal static class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -889,7 +817,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -921,10 +849,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -945,14 +869,6 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix } } } -internal static class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1015,7 +931,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1047,10 +963,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1071,14 +983,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method1__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1141,7 +1045,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1173,10 +1077,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1197,14 +1097,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1267,7 +1159,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1299,10 +1191,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1323,14 +1211,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1393,7 +1273,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1425,10 +1305,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1449,14 +1325,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl } } } -internal static class TUnit_TestProject_MatrixTests_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1526,7 +1394,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1561,10 +1429,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1585,14 +1449,6 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc } } } -internal static class TUnit_TestProject_MatrixTests_Exclusion__int_int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1662,7 +1518,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1694,10 +1550,6 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1718,11 +1570,38 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet } } } -internal static class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt index 7dca1eaf68..1086e4d1c1 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt @@ -67,7 +67,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -99,10 +99,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -124,14 +120,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -205,7 +193,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -237,10 +225,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -262,14 +246,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -343,7 +319,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -375,10 +351,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -400,14 +372,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -496,7 +460,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -528,10 +492,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -553,14 +513,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -676,7 +628,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -708,10 +660,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -733,14 +681,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -814,7 +754,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -846,10 +786,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -871,14 +807,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -962,7 +890,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -994,10 +922,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1018,11 +942,32 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt index c55c9dca2d..b5eeb4d3b0 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt @@ -174,7 +174,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -207,10 +207,6 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") ]; } - private static global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -233,10 +229,25 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo } } } -internal static class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests_MyTest__int_Cancell_DF7AA95A_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), new TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests_MyTest__int_Cancell_DF7AA95A_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt index 372b0834db..9b481766db 100644 --- a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt @@ -85,7 +85,7 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1 Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MultipleClassDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -119,10 +119,6 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1 {Shared = new global::TUnit.Core.SharedType[]{global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None},} ]; } - private static global::TUnit.TestProject.MultipleClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -136,14 +132,6 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1 } } } -internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), new TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -235,7 +223,7 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2 Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_MultipleClassDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -269,10 +257,6 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2 {Shared = new global::TUnit.Core.SharedType[]{global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None},} ]; } - private static global::TUnit.TestProject.MultipleClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -286,11 +270,27 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2 } } } -internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt index 0ce34f4a69..9930cd9aff 100644 --- a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NameOfArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -88,10 +88,6 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NameOfArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NameOfArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NameOfArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -112,10 +108,25 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes } } } -internal static class TUnit_TestProject_NameOfArgumentTests_TestName__string_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.NameOfArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NameOfArgumentTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NameOfArgumentTests), new TUnit_TestProject_NameOfArgumentTests_TestName__string_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt index 0a3892637d..901f221596 100644 --- a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NullableByteArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -89,10 +89,6 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NullableByteArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NullableByteArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NullableByteArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -114,14 +110,6 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te } } } -internal static class TUnit_TestProject_NullableByteArgumentTests_Test__byte__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NullableByteArgumentTests), new TUnit_TestProject_NullableByteArgumentTests_Test__byte__TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -192,7 +180,7 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_by Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NullableByteArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -224,10 +212,6 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_by new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NullableByteArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NullableByteArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NullableByteArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -249,11 +233,27 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_by } } } -internal static class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_byte__ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt index a33ce109c8..1e4b57de38 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -88,10 +88,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -113,14 +109,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource } } } -internal static class TUnit_TestProject_NumberArgumentTests_Int__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Int__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -183,7 +171,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -215,10 +203,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -240,14 +224,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS } } } -internal static class TUnit_TestProject_NumberArgumentTests_Double__double_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Double__double_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -310,7 +286,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -342,10 +318,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -367,14 +339,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou } } } -internal static class TUnit_TestProject_NumberArgumentTests_Float__float_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Float__float_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -437,7 +401,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -469,10 +433,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -494,14 +454,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc } } } -internal static class TUnit_TestProject_NumberArgumentTests_Long__long_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Long__long_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -564,7 +516,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -596,10 +548,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -621,14 +569,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou } } } -internal static class TUnit_TestProject_NumberArgumentTests_ULong__ulong_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -691,7 +631,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -723,10 +663,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -748,11 +684,31 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc } } } -internal static class TUnit_TestProject_NumberArgumentTests_UInt__uint_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.NumberArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt index a33ce109c8..1e4b57de38 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -88,10 +88,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -113,14 +109,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource } } } -internal static class TUnit_TestProject_NumberArgumentTests_Int__int_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Int__int_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -183,7 +171,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -215,10 +203,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -240,14 +224,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS } } } -internal static class TUnit_TestProject_NumberArgumentTests_Double__double_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Double__double_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -310,7 +286,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -342,10 +318,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -367,14 +339,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou } } } -internal static class TUnit_TestProject_NumberArgumentTests_Float__float_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Float__float_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -437,7 +401,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -469,10 +433,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -494,14 +454,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc } } } -internal static class TUnit_TestProject_NumberArgumentTests_Long__long_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Long__long_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -564,7 +516,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -596,10 +548,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -621,14 +569,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou } } } -internal static class TUnit_TestProject_NumberArgumentTests_ULong__ulong_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -691,7 +631,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -723,10 +663,6 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -748,11 +684,31 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc } } } -internal static class TUnit_TestProject_NumberArgumentTests_UInt__uint_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.NumberArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt index 9a2e532079..5f504318c8 100644 --- a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -76,10 +76,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) ]; } - private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.PriorityFilteringTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,14 +88,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource } } } -internal static class TUnit_TestProject_PriorityFilteringTests_High_1_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_High_1_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -150,7 +138,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_2_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -182,10 +170,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_2_TestSource new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) ]; } - private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.PriorityFilteringTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -198,14 +182,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_2_TestSource } } } -internal static class TUnit_TestProject_PriorityFilteringTests_High_2_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_High_2_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -256,7 +232,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_3_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -288,10 +264,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_3_TestSource new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) ]; } - private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.PriorityFilteringTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -304,14 +276,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_3_TestSource } } } -internal static class TUnit_TestProject_PriorityFilteringTests_High_3_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_High_3_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -362,7 +326,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSour Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -394,10 +358,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSour new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) ]; } - private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.PriorityFilteringTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -410,14 +370,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSour } } } -internal static class TUnit_TestProject_PriorityFilteringTests_Medium_1_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -468,7 +420,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSour Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -500,10 +452,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSour new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) ]; } - private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.PriorityFilteringTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -516,14 +464,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSour } } } -internal static class TUnit_TestProject_PriorityFilteringTests_Medium_2_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -574,7 +514,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -606,10 +546,6 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Low) ]; } - private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.PriorityFilteringTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -622,11 +558,31 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource } } } -internal static class TUnit_TestProject_PriorityFilteringTests_Low_1_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt index d1b0492d31..e4d22318b0 100644 --- a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt @@ -298,7 +298,7 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_PropertySetterTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -331,19 +331,6 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") ]; } - private static global::TUnit.TestProject.PropertySetterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.PropertySetterTests() - { - Property1 = default!, - Property2 = default!, - Property3 = default!, - Property4 = default!, - Property5 = default!, - Property6 = default!, - Property7 = default!, - }; - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -356,10 +343,34 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl } } } -internal static class TUnit_TestProject_PropertySetterTests_Test_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.PropertySetterTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PropertySetterTests() + { + Property1 = default!, + Property2 = default!, + Property3 = default!, + Property4 = default!, + Property5 = default!, + Property6 = default!, + Property7 = default!, + }; + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PropertySetterTests), new TUnit_TestProject_PropertySetterTests_Test_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 83210ab5f7..eda4462541 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt @@ -45,7 +45,7 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AssemblyRepeatTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -77,10 +77,6 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe new global::TUnit.Core.RepeatAttribute(3) ]; } - private static global::TUnit.TestProject.AssemblyRepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AssemblyRepeatTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AssemblyRepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -94,14 +90,6 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe } } } -internal static class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepeat_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AssemblyRepeatTests), new TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepeat_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -153,7 +141,7 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeat Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AssemblyRepeatTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -186,10 +174,6 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeat new global::TUnit.Core.RepeatAttribute(3) ]; } - private static global::TUnit.TestProject.AssemblyRepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AssemblyRepeatTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AssemblyRepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -203,11 +187,27 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeat } } } -internal static class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeatOverride_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt index e3a3026946..9dba65cfa3 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt @@ -45,7 +45,7 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_RepeatTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -79,10 +79,6 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn new global::TUnit.Core.RepeatAttribute(3) ]; } - private static global::TUnit.TestProject.RepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.RepeatTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.RepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -96,14 +92,6 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn } } } -internal static class TUnit_TestProject_RepeatTests_One_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.RepeatTests), new TUnit_TestProject_RepeatTests_One_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -155,7 +143,7 @@ internal sealed class TUnit_TestProject_RepeatTests_Two_TestSource : global::TUn Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_RepeatTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -189,10 +177,6 @@ internal sealed class TUnit_TestProject_RepeatTests_Two_TestSource : global::TUn new global::TUnit.Core.RepeatAttribute(3) ]; } - private static global::TUnit.TestProject.RepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.RepeatTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.RepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -206,14 +190,6 @@ internal sealed class TUnit_TestProject_RepeatTests_Two_TestSource : global::TUn } } } -internal static class TUnit_TestProject_RepeatTests_Two_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.RepeatTests), new TUnit_TestProject_RepeatTests_Two_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -265,7 +241,7 @@ internal sealed class TUnit_TestProject_RepeatTests_Three_TestSource : global::T Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_RepeatTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -298,10 +274,6 @@ internal sealed class TUnit_TestProject_RepeatTests_Three_TestSource : global::T new global::TUnit.Core.RepeatAttribute(3) ]; } - private static global::TUnit.TestProject.RepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.RepeatTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.RepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -315,11 +287,28 @@ internal sealed class TUnit_TestProject_RepeatTests_Three_TestSource : global::T } } } -internal static class TUnit_TestProject_RepeatTests_Three_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 b084168f20..d6c68daf73 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt @@ -45,7 +45,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -81,10 +81,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -97,14 +93,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo } } } -internal static class TUnit_TestProject_STAThreadTests_With_STA_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_With_STA_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -156,7 +144,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -191,10 +179,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -207,14 +191,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : } } } -internal static class TUnit_TestProject_STAThreadTests_Without_STA_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_Without_STA_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -266,7 +242,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -302,10 +278,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -318,14 +290,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -377,7 +341,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -413,10 +377,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -429,14 +389,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -488,7 +440,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -524,10 +476,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -540,14 +488,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -599,7 +539,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -635,10 +575,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -651,14 +587,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -710,7 +638,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -746,10 +674,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -762,14 +686,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -821,7 +737,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -857,10 +773,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -873,14 +785,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -932,7 +836,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -968,10 +872,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -984,14 +884,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1043,7 +935,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1079,10 +971,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1095,14 +983,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1154,7 +1034,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1190,10 +1070,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1206,14 +1082,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1265,7 +1133,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1301,10 +1169,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1317,14 +1181,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1376,7 +1232,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1412,10 +1268,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1428,14 +1280,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1487,7 +1331,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1523,10 +1367,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1539,14 +1379,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1598,7 +1430,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1634,10 +1466,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1650,11 +1478,40 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 b084168f20..d6c68daf73 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt @@ -45,7 +45,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -81,10 +81,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -97,14 +93,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo } } } -internal static class TUnit_TestProject_STAThreadTests_With_STA_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_With_STA_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -156,7 +144,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -191,10 +179,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -207,14 +191,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : } } } -internal static class TUnit_TestProject_STAThreadTests_Without_STA_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_Without_STA_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -266,7 +242,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -302,10 +278,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -318,14 +290,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -377,7 +341,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -413,10 +377,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -429,14 +389,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -488,7 +440,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -524,10 +476,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -540,14 +488,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -599,7 +539,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -635,10 +575,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -651,14 +587,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -710,7 +638,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -746,10 +674,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -762,14 +686,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -821,7 +737,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -857,10 +773,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -873,14 +785,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -932,7 +836,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -968,10 +872,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -984,14 +884,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1043,7 +935,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1079,10 +971,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1095,14 +983,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1154,7 +1034,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1190,10 +1070,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1206,14 +1082,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1265,7 +1133,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1301,10 +1169,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1317,14 +1181,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1376,7 +1232,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1412,10 +1268,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1428,14 +1280,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1487,7 +1331,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1523,10 +1367,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1539,14 +1379,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1598,7 +1430,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1634,10 +1466,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1650,11 +1478,40 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 b084168f20..d6c68daf73 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt @@ -45,7 +45,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -81,10 +81,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -97,14 +93,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo } } } -internal static class TUnit_TestProject_STAThreadTests_With_STA_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_With_STA_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -156,7 +144,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -191,10 +179,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -207,14 +191,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : } } } -internal static class TUnit_TestProject_STAThreadTests_Without_STA_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_Without_STA_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -266,7 +242,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -302,10 +278,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -318,14 +290,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -377,7 +341,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -413,10 +377,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -429,14 +389,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -488,7 +440,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -524,10 +476,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -540,14 +488,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -599,7 +539,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -635,10 +575,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -651,14 +587,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -710,7 +638,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -746,10 +674,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -762,14 +686,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -821,7 +737,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -857,10 +773,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -873,14 +785,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -932,7 +836,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -968,10 +872,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -984,14 +884,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1043,7 +935,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1079,10 +971,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1095,14 +983,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1154,7 +1034,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1190,10 +1070,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1206,14 +1082,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1265,7 +1133,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1301,10 +1169,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1317,14 +1181,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1376,7 +1232,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1412,10 +1268,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1428,14 +1280,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1487,7 +1331,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1523,10 +1367,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1539,14 +1379,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1598,7 +1430,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1634,10 +1466,6 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1650,11 +1478,40 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes } } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } 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 9c132d71b3..53d1e6f721 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt @@ -15,15 +15,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -41,34 +33,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -91,13 +69,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_With_STA_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_With_STA_TestSource()); + 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)); + } } } @@ -121,14 +114,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "Without_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -146,34 +132,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Without_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -196,13 +168,27 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_Without_STA_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_Without_STA_TestSource()); + 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)); + } } } @@ -226,15 +212,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithSimpleAwait", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -252,34 +230,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -302,13 +266,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource()); + 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)); + } } } @@ -332,15 +311,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -358,34 +329,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -408,13 +365,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource()); + 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)); + } } } @@ -438,15 +410,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithConfigureAwaitTrue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -464,34 +428,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithConfigureAwaitTrue()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -514,13 +464,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource()); + 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)); + } } } @@ -544,15 +509,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithNestedAsyncCalls", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -570,34 +527,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -620,13 +563,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource()); + 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)); + } } } @@ -650,15 +608,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskFromResult", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -676,34 +626,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -726,13 +662,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource()); + 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)); + } } } @@ -756,15 +707,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithCompletedTask", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -782,34 +725,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -832,13 +761,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource()); + 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)); + } } } @@ -862,15 +806,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskRun", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -888,34 +824,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -938,13 +860,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource()); + 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)); + } } } @@ -968,15 +905,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithMultipleAwaits", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -994,34 +923,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1044,13 +959,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource()); + 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)); + } } } @@ -1074,15 +1004,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithAsyncEnumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1100,34 +1022,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1150,13 +1058,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource()); + 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)); + } } } @@ -1180,15 +1103,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskWhenAll", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1206,34 +1121,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1256,13 +1157,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource()); + 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)); + } } } @@ -1286,15 +1202,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithExceptionHandling", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1312,34 +1220,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1362,13 +1256,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource()); + 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)); + } } } @@ -1392,15 +1301,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithThrowsNothingAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1418,34 +1319,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1468,13 +1355,28 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Materializer = GetTests }; } -} -internal static class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + private static global::System.Attribute[] __CreateAttributes() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource()); + 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)); + } } } @@ -1498,15 +1400,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithFuncAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1524,34 +1418,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1574,12 +1454,64 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } -internal static class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt index a4ab51e5b0..03ed9cf3f7 100644 --- a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt @@ -67,7 +67,7 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_StringArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -99,10 +99,6 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.StringArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.StringArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.StringArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -124,14 +120,6 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS } } } -internal static class TUnit_TestProject_StringArgumentTests_Normal__string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.StringArgumentTests), new TUnit_TestProject_StringArgumentTests_Normal__string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -201,7 +189,7 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__Te Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_StringArgumentTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -233,10 +221,6 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__Te new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.StringArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.StringArgumentTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.StringArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -258,11 +242,27 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__Te } } } -internal static class TUnit_TestProject_StringArgumentTests_Nullable__string__ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt index a7c08e8f86..6872c508a6 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt @@ -67,7 +67,7 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1304_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -99,10 +99,6 @@ 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::TUnit.TestProject.Bugs._1304.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1304.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1304.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -124,14 +120,6 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ } } } -internal static class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ReturnsFailure__string__Canc_9F7FA274_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - 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()); - } -} // ===== FILE SEPARATOR ===== @@ -198,7 +186,7 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_Thr Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1304_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -230,10 +218,6 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_Thr new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.Bugs._1304.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1304.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1304.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -254,14 +238,6 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_Thr } } } -internal static class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_ThrowsException__string__ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public 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()); - } -} // ===== FILE SEPARATOR ===== @@ -325,7 +301,7 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_Re Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1304_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -357,10 +333,6 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_Re new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.Bugs._1304.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1304.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1304.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -381,11 +353,28 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_Re } } } -internal static class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_ReturnsAccountId__string_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt index b4ba6b7b8d..4235b69afc 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt @@ -126,7 +126,7 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1538_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -158,10 +158,6 @@ 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::TUnit.TestProject.Bugs._1538.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1538.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1538.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -183,14 +179,6 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string } } } -internal static class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string__string__string__string__st_35276EED_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public 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()); - } -} // ===== FILE SEPARATOR ===== @@ -379,7 +367,7 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_strin Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1538_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -411,10 +399,6 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_strin new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.Bugs._1538.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1538.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1538.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -436,11 +420,27 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_strin } } } -internal static class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_string__string__string__string__s_972B9C97_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt index 4a6ffc898f..63805b88d9 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : globa Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1539_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -80,10 +80,6 @@ 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::TUnit.TestProject.Bugs._1539.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1539.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1539.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -97,10 +93,25 @@ internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : globa } } } -internal static class TUnit_TestProject_Bugs__1539_Tests_Test_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._1539.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1539.Tests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1539.Tests), new TUnit_TestProject_Bugs__1539_Tests_Test_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt index d4649937f3..864a6b4446 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1589_MyTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -91,10 +91,6 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl {Shared = global::TUnit.Core.SharedType.None,} ]; } - private static global::TUnit.TestProject.Bugs._1589.MyTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1589.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1589.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -107,10 +103,25 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl } } } -internal static class TUnit_TestProject_Bugs__1589_MyTests_Test1_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + 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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1589.MyTests), new TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt index 5a987b317f..81d5a1667c 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1594_MyTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -91,10 +91,6 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl {Shared = global::TUnit.Core.SharedType.None,} ]; } - private static global::TUnit.TestProject.Bugs._1594.MyTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1594.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1594.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -108,10 +104,25 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl } } } -internal static class TUnit_TestProject_Bugs__1594_MyTests_Test1_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + 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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1594.MyTests), new TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt index 1de5a70733..1db6641386 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1603_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -88,10 +88,6 @@ 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::TUnit.TestProject.Bugs._1603.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1603.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1603.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -112,14 +108,6 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short } } } -internal static class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short_Converts__short_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public 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()); - } -} // ===== FILE SEPARATOR ===== @@ -182,7 +170,7 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Conver Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1603_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -214,10 +202,6 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Conver new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.Bugs._1603.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1603.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1603.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -238,11 +222,27 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Conver } } } -internal static class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Converts__short_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt index 0fa5ea0460..a36883a4fa 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt @@ -57,7 +57,7 @@ internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1692_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -89,10 +89,6 @@ 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::TUnit.TestProject.Bugs._1692.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1692.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1692.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -113,10 +109,25 @@ internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestS } } } -internal static class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._1692.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1692.Tests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt index 8095272034..ae3a47ada6 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt @@ -68,7 +68,7 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1821_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -101,10 +101,6 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin new global::TUnit.Core.ClassDataSourceAttribute() ]; } - private static global::TUnit.TestProject.Bugs._1821.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1821.Tests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1821.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -125,14 +121,6 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin } } } -internal static class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__string_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1821.Tests), new TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__string_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -207,7 +195,7 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__strin Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__1821_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -240,10 +228,6 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__strin new global::TUnit.Core.ClassDataSourceAttribute() ]; } - private static global::TUnit.TestProject.Bugs._1821.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1821.Tests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1821.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -264,11 +248,27 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__strin } } } -internal static class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__string_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt index e0804527cb..aaa59337bd 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -37,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -88,6 +68,31 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_ModuleInitializer { @@ -118,12 +123,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -152,43 +152,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS ReflectionInfo = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -211,6 +188,39 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_ModuleInitializer { @@ -241,12 +251,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(false), @@ -276,43 +281,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS ReflectionInfo = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest).GetMethod("Test3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -335,6 +317,39 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt index f2ca4ad52e..ee00c4e005 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt @@ -61,7 +61,7 @@ internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__2083_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -93,10 +93,6 @@ 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::TUnit.TestProject.Bugs._2083.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2083.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2083.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -118,10 +114,25 @@ internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource } } } -internal static class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.Bugs._2083.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2083.Tests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt index 6936f4b8d2..f5675a49b0 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt @@ -56,7 +56,7 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__d Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__2085_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -88,10 +88,6 @@ 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::TUnit.TestProject.Bugs._2085.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2085.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2085.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -112,14 +108,6 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__d } } } -internal static class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__double_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public 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()); - } -} // ===== FILE SEPARATOR ===== @@ -182,7 +170,7 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__fl Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__2085_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -214,10 +202,6 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__fl new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.Bugs._2085.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2085.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2085.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -238,11 +222,27 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__fl } } } -internal static class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__float_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt index fc340e8d8d..54e3faab1e 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt @@ -64,7 +64,7 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSo Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__2112_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -96,10 +96,6 @@ 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::TUnit.TestProject.Bugs._2112.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2112.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2112.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -151,14 +147,6 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSo } } } -internal static class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2112.Tests), new TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -229,7 +217,7 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_Bugs__2112_Tests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -261,10 +249,6 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.Bugs._2112.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2112.Tests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2112.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -316,11 +300,27 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestS } } } -internal static class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + 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()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt index 41afd0d05c..08b37a06bc 100644 --- a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt @@ -86,7 +86,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTes Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -120,10 +120,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTes new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -136,14 +132,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTes } } } -internal static class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTest__CancellationToken_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTest__CancellationToken_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -236,7 +224,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -272,10 +260,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest_ new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -288,14 +272,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest_ } } } -internal static class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest__CancellationToken_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest__CancellationToken_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -388,7 +364,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedT Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -423,10 +399,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedT new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -439,14 +411,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedT } } } -internal static class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedTimeoutAttribute__CancellationToken_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_InheritedTimeoutAttribute__CancellationToken_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -549,7 +513,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -584,10 +548,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__ new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -609,14 +569,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__ } } } -internal static class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__int_CancellationToken_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__int_CancellationToken_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -740,7 +692,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSource Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -775,10 +727,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSource new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -800,14 +748,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSource } } } -internal static class TUnit_TestProject_TimeoutCancellationTokenTests_DataSourceTest__int_CancellationToken_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_DataSourceTest__int_CancellationToken_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -910,7 +850,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -946,10 +886,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -971,14 +907,6 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest } } } -internal static class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest__int_CancellationToken_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest__int_CancellationToken_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1071,7 +999,7 @@ internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNot Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TimeoutDoesNotFireTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1106,10 +1034,6 @@ internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNot new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::TUnit.TestProject.TimeoutDoesNotFireTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TimeoutDoesNotFireTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutDoesNotFireTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1122,14 +1046,6 @@ internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNot } } } -internal static class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNotTimeout__CancellationToken_ModuleInitializer -{ - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), new TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNotTimeout__CancellationToken_TestSource()); - } -} // ===== FILE SEPARATOR ===== @@ -1222,7 +1138,7 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_CancellationTokenTriggeredTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -1257,10 +1173,6 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::TUnit.TestProject.CancellationTokenTriggeredTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CancellationTokenTriggeredTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CancellationTokenTriggeredTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -1273,10 +1185,76 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella } } } -internal static class TUnit_TestProject_CancellationTokenTriggeredTests_CancellationTokenIsTriggered__Cancel_38B13F70_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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() + { + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), new TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNotTimeout__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_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])); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), new TUnit_TestProject_CancellationTokenTriggeredTests_CancellationTokenIsTriggered__Cancel_38B13F70_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt index b922af14dc..dec1759c85 100644 --- a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt @@ -81,7 +81,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -113,10 +113,6 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::TUnit.TestProject.TupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -138,10 +134,25 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu } } } -internal static class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt index 2d39e5f4e3..6d459dbda5 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt @@ -71,7 +71,7 @@ internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__in Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_AotDataSourceTest__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -102,10 +102,6 @@ internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__in new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.AotDataSourceTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AotDataSourceTest(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AotDataSourceTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -127,10 +123,25 @@ internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__in } } } -internal static class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__int_int_int_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.AotDataSourceTest CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AotDataSourceTest(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AotDataSourceTest), new TUnit_TestProject_AotDataSourceTest_TestWithDataSource__int_int_int_TestSource()); } diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt index 9bfcf8090a..8a560fb68c 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ConfigurationTest__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.ConfigurationTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConfigurationTest(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConfigurationTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,10 +88,25 @@ internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ } } } -internal static class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.ConfigurationTest CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConfigurationTest(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConfigurationTest), new TUnit_TestProject_ConfigurationTest_TestWithConfiguration_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 6ae76bb395..d49b1e15a1 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_ModuleInitializerTest__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.ModuleInitializerTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ModuleInitializerTest(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ModuleInitializerTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,10 +88,25 @@ internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit } } } -internal static class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.ModuleInitializerTest CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ModuleInitializerTest(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ModuleInitializerTest), new TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit_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 af82188332..d0e8f28e2c 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt @@ -44,7 +44,7 @@ internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestS Parent = null }) }, - InstanceFactory = __CreateInstance, + InstanceFactory = TUnit_TestProject_TypedDelegateTest__ClassHelper.CreateInstance, InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); @@ -75,10 +75,6 @@ internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestS new global::TUnit.Core.TestAttribute() ]; } - private static global::TUnit.TestProject.TypedDelegateTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TypedDelegateTest(); - } private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TypedDelegateTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try @@ -92,10 +88,25 @@ internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestS } } } -internal static class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_ModuleInitializer + + +// ===== FILE SEPARATOR ===== + +// +#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 { + internal static global::TUnit.TestProject.TypedDelegateTest CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TypedDelegateTest(); + } [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TypedDelegateTest), new TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestSource()); } diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/InstanceFactoryGenerator.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/InstanceFactoryGenerator.cs index e90f1b336c..f7fa4ae085 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/InstanceFactoryGenerator.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/InstanceFactoryGenerator.cs @@ -193,6 +193,60 @@ public static void GenerateInstanceFactoryAsMethod(CodeWriter writer, ITypeSymbo writer.AppendLine("}"); } + /// + /// Pre-generates the instance factory method body as a string. + /// Used by the per-class helper pipeline where ISymbol is available during the transform step + /// but not during source output. + /// + public static string GenerateInstanceFactoryBody(ITypeSymbol typeSymbol) + { + var bodyWriter = new CodeWriter(includeHeader: false); + var className = typeSymbol.GloballyQualified(); + + if (typeSymbol is INamedTypeSymbol namedTypeSymbol && HasClassConstructorAttribute(namedTypeSymbol)) + { + GenerateClassConstructorStubBody(bodyWriter); + } + else if (typeSymbol.HasParameterizedConstructor()) + { + var constructor = GetPrimaryConstructor(typeSymbol); + if (constructor != null) + { + GenerateTypedConstructorCallBody(bodyWriter, className, constructor); + } + else + { + bodyWriter.AppendLine("return null!;"); + } + } + else + { + var requiredProperties = RequiredPropertyHelper.GetAllRequiredProperties(typeSymbol); + + if (!requiredProperties.Any()) + { + bodyWriter.AppendLine($"return new {className}();"); + } + else + { + bodyWriter.AppendLine($"return new {className}()"); + bodyWriter.AppendLine("{"); + bodyWriter.Indent(); + + foreach (var property in requiredProperties) + { + var defaultValue = RequiredPropertyHelper.GetDefaultValueForType(property.Type); + bodyWriter.AppendLine($"{property.Name} = {defaultValue},"); + } + + bodyWriter.Unindent(); + bodyWriter.AppendLine("};"); + } + } + + return bodyWriter.ToString(); + } + private static IMethodSymbol? GetPrimaryConstructor(ITypeSymbol typeSymbol) { // Materialize constructors once to avoid multiple enumerations diff --git a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs index 828cab2c23..c36039f280 100644 --- a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs +++ b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs @@ -60,6 +60,19 @@ public void Initialize(IncrementalGeneratorInitializationContext context) .Where(static m => m is not null) .Combine(enabledProvider); + // Per-class helper pipeline: collect non-generic direct test methods, + // group by class, emit one helper per class with shared CreateInstance + batched ModuleInitializer. + // NOTE: .Collect() is a fan-in that invalidates all class helpers when any [Test] method changes. + // This is the same trade-off as PropertyInjectionSourceGenerator. Roslyn's output caching on + // ClassTestGroup's value equality means only the changed class's file is actually re-emitted, + // but GroupMethodsByClass still re-executes for all classes on every edit. + var classHelperProvider = testMethodsProvider + .Select(static (data, _) => data.Left) + .Where(static m => m is not null && !m!.IsGenericType && !m.IsGenericMethod) + .Collect() + .SelectMany(static (methods, _) => GroupMethodsByClass(methods)) + .Combine(enabledProvider); + context.RegisterSourceOutput(testMethodsProvider, static (context, data) => { @@ -71,6 +84,17 @@ public void Initialize(IncrementalGeneratorInitializationContext context) GenerateTestMethodSource(context, testMethod); }); + context.RegisterSourceOutput(classHelperProvider, + static (context, data) => + { + var (classGroup, isEnabled) = data; + if (!isEnabled) + { + return; + } + GenerateClassHelper(context, classGroup); + }); + context.RegisterSourceOutput(inheritsTestsClassesProvider, static (context, data) => { @@ -392,14 +416,21 @@ private static void GenerateTestMetadata(CodeWriter writer, TestMethodMetadata t // Generate EnumerateTestDescriptors method for fast filtering GenerateEnumerateTestDescriptors(writer, testMethod); + // Non-generic, direct test methods use the per-class helper for instance creation + // and module initialization. Generic or inherited tests keep the per-method pattern. + var useClassHelper = !needsList && testMethod.InheritanceDepth == 0; + if (!needsList) { // Emit named static helper methods to avoid generating a <>c display class. // These are referenced by method group in the metadata above. writer.AppendLine(); EmitAttributeFactoryMethod(writer, testMethod); - writer.AppendLine(); - EmitInstanceFactoryMethod(writer, testMethod); + if (!useClassHelper) + { + writer.AppendLine(); + EmitInstanceFactoryMethod(writer, testMethod); + } if (testMethod is { IsGenericType: false, IsGenericMethod: false }) { writer.AppendLine(); @@ -410,7 +441,10 @@ private static void GenerateTestMetadata(CodeWriter writer, TestMethodMetadata t writer.Unindent(); writer.AppendLine("}"); - GenerateModuleInitializer(writer, testMethod, uniqueClassName); + if (!useClassHelper) + { + GenerateModuleInitializer(writer, testMethod, uniqueClassName); + } } private static void GenerateTestMetadataInstance(CodeWriter writer, TestMethodMetadata testMethod, string className, bool addToResultsList = true, bool useNamedMethods = false) @@ -1797,7 +1831,17 @@ private static void GenerateTypedInvokers(CodeWriter writer, TestMethodMetadata { if (useNamedMethods) { - writer.AppendLine("InstanceFactory = __CreateInstance,"); + 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,"); + } + else + { + // Inherited or generic tests keep their own __CreateInstance method + writer.AppendLine("InstanceFactory = __CreateInstance,"); + } } else { @@ -2367,6 +2411,86 @@ private static void GenerateModuleInitializer(CodeWriter writer, TestMethodMetad writer.AppendLine("}"); } + private static IEnumerable GroupMethodsByClass(ImmutableArray methods) + { + return methods + .Where(m => m is not null) + .GroupBy(m => m!.TypeSymbol, SymbolEqualityComparer.Default) + .Select(g => + { + var first = g.First()!; + var typeSymbol = first.TypeSymbol; + + 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(), + InstanceFactoryBodyCode = InstanceFactoryGenerator.GenerateInstanceFactoryBody(typeSymbol), + }; + }); + } + + private static void GenerateClassHelper(SourceProductionContext context, ClassTestGroup classGroup) + { + try + { + var writer = new CodeWriter(); + GenerateFileHeader(writer); + + 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("{"); + writer.Indent(); + + // CreateInstance method + writer.AppendLine($"internal static {classGroup.ClassFullyQualified} CreateInstance(global::System.Type[] typeArgs, object?[] args)"); + writer.AppendLine("{"); + writer.Indent(); + writer.AppendRaw(classGroup.InstanceFactoryBodyCode); + writer.Unindent(); + writer.AppendLine("}"); + + writer.AppendLine(); + + // Batched ModuleInitializer + 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.Unindent(); + writer.AppendLine("}"); + + writer.Unindent(); + writer.AppendLine("}"); + + context.AddSource($"{classGroup.ClassHelperName}.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}", + "TUnit", + DiagnosticSeverity.Error, + true), + Location.None, + classGroup.ClassFullyQualified, + ex.ToString())); + } + } + private enum TestReturnPattern { Void, // void methods diff --git a/TUnit.Core.SourceGenerator/Helpers/FileNameHelper.cs b/TUnit.Core.SourceGenerator/Helpers/FileNameHelper.cs index 973715db7a..8edf82cbc0 100644 --- a/TUnit.Core.SourceGenerator/Helpers/FileNameHelper.cs +++ b/TUnit.Core.SourceGenerator/Helpers/FileNameHelper.cs @@ -91,6 +91,66 @@ public static string GetDeterministicFileNameForMethod(INamedTypeSymbol typeSymb return baseName + ".g.cs"; } + /// + /// Generates a deterministic class helper name for a test class. + /// Format: {Namespace}_{ClassName}__ClassHelper + /// Must produce the same name for the same type across both per-class and per-method pipelines. + /// + public static string GetSafeClassHelperName(INamedTypeSymbol typeSymbol) + { + var sb = new StringBuilder(); + + // Add namespace + if (!typeSymbol.ContainingNamespace.IsGlobalNamespace) + { + sb.Append(SanitizeForFileName(typeSymbol.ContainingNamespace.ToDisplayString())); + sb.Append('_'); + } + + // Walk from the target type up to the outermost containing type, then reverse + // to get outer-to-inner order (e.g. [OuterClass, InnerClass, TargetType]) + var typeHierarchy = new List(); + var currentType = typeSymbol; + while (currentType != null) + { + typeHierarchy.Add(SanitizeForFileName(currentType.Name)); + currentType = currentType.ContainingType; + } + + typeHierarchy.Reverse(); + + for (int i = 0; i < typeHierarchy.Count; i++) + { + if (i > 0) sb.Append('_'); + sb.Append(typeHierarchy[i]); + } + + // Add generic parameters if any (for the innermost type) + if (typeSymbol.TypeArguments.Length > 0) + { + sb.Append('_'); + for (int i = 0; i < typeSymbol.TypeArguments.Length; i++) + { + if (i > 0) sb.Append('_'); + sb.Append(SanitizeForFileName(typeSymbol.TypeArguments[i].Name)); + } + } + + var baseName = sb.ToString(); + var helperSuffix = "__ClassHelper"; + + // Truncate and append a hash if the name would exceed the limit + const int fileExtLength = 5; // ".g.cs" + if (baseName.Length + helperSuffix.Length + fileExtLength > MaxHintNameLength) + { + var hashSuffix = $"_{GetStableHashCode(baseName):X8}"; + var maxBaseLength = MaxHintNameLength - fileExtLength - helperSuffix.Length - hashSuffix.Length; + baseName = baseName.Substring(0, maxBaseLength) + hashSuffix; + } + + return baseName + helperSuffix; + } + /// /// 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 new file mode 100644 index 0000000000..30a87831b7 --- /dev/null +++ b/TUnit.Core.SourceGenerator/Models/ClassTestGroup.cs @@ -0,0 +1,31 @@ +namespace TUnit.Core.SourceGenerator.Models; + +/// +/// A per-class grouping model for generating shared class helpers. +/// Contains only primitives (no ISymbol references) for incremental caching. +/// +public sealed record ClassTestGroup +{ + /// + /// The fully qualified class name with global:: prefix. + /// e.g. "global::MyNamespace.MyClass" + /// + public required string ClassFullyQualified { get; init; } + + /// + /// The safe identifier name for the class helper. + /// e.g. "MyNamespace_MyClass__ClassHelper" + /// + public required string ClassHelperName { get; init; } + + /// + /// The per-method TestSource class names that should be registered in Initialize(). + /// + public required EquatableArray TestSourceClassNames { 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; } +}