diff --git a/Directory.Packages.props b/Directory.Packages.props index 8e4f8b1cd3..1f65e9f665 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -55,6 +55,7 @@ + diff --git a/TUnit.Assertions.Analyzers/TUnit.Assertions.Analyzers.csproj b/TUnit.Assertions.Analyzers/TUnit.Assertions.Analyzers.csproj index 8e4b5c4dbd..b519447b98 100644 --- a/TUnit.Assertions.Analyzers/TUnit.Assertions.Analyzers.csproj +++ b/TUnit.Assertions.Analyzers/TUnit.Assertions.Analyzers.csproj @@ -42,7 +42,4 @@ Resources.resx - - - \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.AbstractClass.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.AbstractClass.verified.txt new file mode 100644 index 0000000000..ad47dbb93f --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.AbstractClass.verified.txt @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt new file mode 100644 index 0000000000..49bf2db425 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt @@ -0,0 +1,90 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new Inherited_ConcreteClass1()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); + var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.AbstractTests.ConcreteClass1() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AssertClassName()), + TestFilePath = @"", + TestLineNumber = 8, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", + TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), + ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "AssertClassName", + TestFilePath = @"", + TestLineNumber = 8, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt new file mode 100644 index 0000000000..d85e2235e4 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt @@ -0,0 +1,274 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConcreteClass2()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.AbstractTests.ConcreteClass2() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.SecondTest()), + TestFilePath = @"", + TestLineNumber = 11, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +}, new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest:0", + TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "SecondTest", + TestFilePath = @"", + TestLineNumber = 11, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Inherited_ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new Inherited_ConcreteClass2()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.AbstractTests.ConcreteClass2() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AssertClassName()), + TestFilePath = @"", + TestLineNumber = 8, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +}, new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName:0", + TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "AssertClassName", + TestFilePath = @"", + TestLineNumber = 8, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new Inherited_ConcreteClass1()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); + var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.AbstractTests.ConcreteClass1() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AssertClassName()), + TestFilePath = @"", + TestLineNumber = 8, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", + TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), + ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "AssertClassName", + TestFilePath = @"", + TestLineNumber = 8, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt new file mode 100644 index 0000000000..ef56fb2924 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt @@ -0,0 +1,785 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base1(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterAll1", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base1.AfterAll1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 5, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterEach1", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base2(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterAll2", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base2.AfterAll2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 20, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterEach2", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base3(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterAll3", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base3.AfterAll3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 35, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterEach3", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 50, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 56, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 62, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 68, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.cs b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.cs index 298413e51b..4901d67714 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.cs @@ -13,96 +13,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(14); - - await AssertFileContains(generatedFiles[0], - """ - new AfterClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterAll1", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base1.AfterAll1()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 5, - }, - """); - - await AssertFileContains(generatedFiles[2], - """ - new AfterClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterAll2", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base2.AfterAll2()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 20, - }, - """); - - await AssertFileContains(generatedFiles[4], - """ - new AfterClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterAll3", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base3.AfterAll3()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 35, - }, - """); - - await AssertFileContains(generatedFiles[6], - """ - new AfterClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 50, - }, - """); - - await AssertFileContains(generatedFiles[7], - """ - new AfterClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 56, - }, - """); - - await AssertFileContains(generatedFiles[8], - """ - new AfterClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp(cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 62, - }, - """); - - await AssertFileContains(generatedFiles[9], - """ - new AfterClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 68, - }, - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AfterEachTests.cs b/TUnit.Core.SourceGenerator.Tests/AfterEachTests.cs index 599e7b9b2d..85401a8866 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterEachTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/AfterEachTests.cs @@ -13,82 +13,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(14); - - await AssertFileContains(generatedFiles[1], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterEach1", 0, []), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach1()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[3], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterEach2", 0, []), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach2()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[5], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterEach3", 0, []), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach3()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[10], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, []), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[11], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup(cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[12], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[13], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt new file mode 100644 index 0000000000..ef56fb2924 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt @@ -0,0 +1,785 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base1(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterAll1", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base1.AfterAll1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 5, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterEach1", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base2(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterAll2", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base2.AfterAll2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 20, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterEach2", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base3(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterAll3", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base3.AfterAll3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 35, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterEach3", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 50, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 56, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 62, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) + { + return + [ + new AfterClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 68, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_CleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt new file mode 100644 index 0000000000..356e64ab79 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt @@ -0,0 +1,785 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase1 : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase1(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) + { + return + [ + new AfterAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1).GetMethod("AfterAll1", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyBase1.AfterAll1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 5, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1).GetMethod("AfterEach1", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase2 : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase2(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) + { + return + [ + new AfterAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2).GetMethod("AfterAll2", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyBase2.AfterAll2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 20, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2).GetMethod("AfterEach2", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase3 : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase3(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) + { + return + [ + new AfterAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3).GetMethod("AfterAll3", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyBase3.AfterAll3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 35, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3).GetMethod("AfterEach3", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyCleanupTests(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) + { + return + [ + new AfterAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUp", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUp()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 50, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyCleanupTests(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) + { + return + [ + new AfterAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 56, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyCleanupTests(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) + { + return + [ + new AfterAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUp(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 62, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyCleanupTests(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) + { + return + [ + new AfterAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 68, + }, + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyCleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("Cleanup", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyCleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyCleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyCleanupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.cs b/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.cs index 4049d8f87a..7ce8f8779b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.cs @@ -13,96 +13,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(14); - - await AssertFileContains(generatedFiles[0], - """ - new AfterAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1).GetMethod("AfterAll1", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyBase1.AfterAll1()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 5, - }, - """); - - await AssertFileContains(generatedFiles[2], - """ - new AfterAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2).GetMethod("AfterAll2", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyBase2.AfterAll2()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 20, - }, - """); - - await AssertFileContains(generatedFiles[4], - """ - new AfterAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3).GetMethod("AfterAll3", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyBase3.AfterAll3()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 35, - }, - """); - - await AssertFileContains(generatedFiles[6], - """ - new AfterAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUp", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUp()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 50, - }, - """); - - await AssertFileContains(generatedFiles[7], - """ - new AfterAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUpWithContext(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 56, - }, - """); - - await AssertFileContains(generatedFiles[8], - """ - new AfterAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUp(cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 62, - }, - """); - - await AssertFileContains(generatedFiles[9], - """ - new AfterAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUpWithContext(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 68, - }, - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt new file mode 100644 index 0000000000..2352bcfd24 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt @@ -0,0 +1,785 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase1 : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase1(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + new BeforeAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1).GetMethod("BeforeAll1", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblyBase1.BeforeAll1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 5, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1).GetMethod("BeforeEach1", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase2 : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase2(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + new BeforeAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2).GetMethod("BeforeAll2", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblyBase2.BeforeAll2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 20, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2).GetMethod("BeforeEach2", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase3 : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase3(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + new BeforeAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3).GetMethod("BeforeAll3", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblyBase3.BeforeAll3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 35, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblyBase3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblyBase3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3).GetMethod("BeforeEach3", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblySetupTests(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + new BeforeAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUp", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUp()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 50, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblySetupTests(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + new BeforeAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 56, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblySetupTests(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + new BeforeAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUp(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 62, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenerator.IAssemblyHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblySetupTests(); + SourceRegistrar.RegisterAssemblyHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryAssemblyHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeAssemblyHooks(string sessionId) + { + return + [ + new BeforeAssemblyHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 68, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterAssemblyHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblySetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("Setup", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblySetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("Setup", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblySetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_AssemblySetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.cs b/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.cs index 1e9084ef63..ead54a15d9 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.cs @@ -13,96 +13,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(14); - - await AssertFileContains(generatedFiles[0], - """ - new BeforeAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1).GetMethod("BeforeAll1", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblyBase1.BeforeAll1()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 5, - }, - """); - - await AssertFileContains(generatedFiles[2], - """ - new BeforeAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2).GetMethod("BeforeAll2", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblyBase2.BeforeAll2()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 20, - }, - """); - - await AssertFileContains(generatedFiles[4], - """ - new BeforeAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3).GetMethod("BeforeAll3", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblyBase3.BeforeAll3()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 35, - }, - """); - - await AssertFileContains(generatedFiles[6], - """ - new BeforeAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUp", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUp()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 50, - }, - """); - - await AssertFileContains(generatedFiles[7], - """ - new BeforeAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUpWithContext(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 56, - }, - """); - - await AssertFileContains(generatedFiles[8], - """ - new BeforeAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUp(cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 62, - }, - """); - - await AssertFileContains(generatedFiles[9], - """ - new BeforeAssemblyHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUpWithContext(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 68, - }, - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.verified.txt new file mode 100644 index 0000000000..9f5922b241 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.verified.txt @@ -0,0 +1,259 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class BasicTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new BasicTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.BasicTests); + var methodInfo = typeof(global::TUnit.TestProject.BasicTests).GetMethod("SynchronousTest", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.BasicTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.BasicTests.SynchronousTest:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.SynchronousTest()), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.BasicTests.SynchronousTest:0", + TestClass = typeof(global::TUnit.TestProject.BasicTests), + ReturnType = typeof(global::TUnit.TestProject.BasicTests).GetMethod("SynchronousTest", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "SynchronousTest", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class BasicTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new BasicTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.BasicTests); + var methodInfo = typeof(global::TUnit.TestProject.BasicTests).GetMethod("AsynchronousTest", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.BasicTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.BasicTests.AsynchronousTest:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AsynchronousTest()), + TestFilePath = @"", + TestLineNumber = 11, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.BasicTests.AsynchronousTest:0", + TestClass = typeof(global::TUnit.TestProject.BasicTests), + ReturnType = typeof(global::TUnit.TestProject.BasicTests).GetMethod("AsynchronousTest", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "AsynchronousTest", + TestFilePath = @"", + TestLineNumber = 11, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class BasicTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new BasicTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.BasicTests); + var methodInfo = typeof(global::TUnit.TestProject.BasicTests).GetMethod("ValueTaskAsynchronousTest", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.BasicTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.ValueTaskAsynchronousTest()), + TestFilePath = @"", + TestLineNumber = 17, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest:0", + TestClass = typeof(global::TUnit.TestProject.BasicTests), + ReturnType = typeof(global::TUnit.TestProject.BasicTests).GetMethod("ValueTaskAsynchronousTest", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "ValueTaskAsynchronousTest", + TestFilePath = @"", + TestLineNumber = 17, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.cs b/TUnit.Core.SourceGenerator.Tests/BasicTests.cs index 5c84bc3c46..54e6db05d3 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.cs @@ -12,9 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(3); - - await AssertFileContains(generatedFiles[0], "TestId = $\"TUnit.TestProject.BasicTests.SynchronousTest:0\","); - await AssertFileContains(generatedFiles[1], "TestId = $\"TUnit.TestProject.BasicTests.AsynchronousTest:0\","); - await AssertFileContains(generatedFiles[2], "TestId = $\"TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest:0\","); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt new file mode 100644 index 0000000000..ee4093c9d9 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt @@ -0,0 +1,785 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base1(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeAll1", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base1.BeforeAll1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 5, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeEach1", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base2(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeAll2", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base2.BeforeAll2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 20, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeEach2", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base3(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeAll3", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base3.BeforeAll3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 35, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeEach3", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 50, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 56, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 62, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 68, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.cs b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.cs index 9b08e65d9f..b3a3bac11a 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.cs @@ -13,96 +13,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(14); - - await AssertFileContains(generatedFiles[0], - """ - new BeforeClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeAll1", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base1.BeforeAll1()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 5, - }, - """); - - await AssertFileContains(generatedFiles[2], - """ - new BeforeClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeAll2", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base2.BeforeAll2()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 20, - }, - """); - - await AssertFileContains(generatedFiles[4], - """ - new BeforeClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeAll3", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base3.BeforeAll3()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 35, - }, - """); - - await AssertFileContains(generatedFiles[6], - """ - new BeforeClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, []), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 50, - }, - """); - - await AssertFileContains(generatedFiles[7], - """ - new BeforeClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 56, - }, - """); - - await AssertFileContains(generatedFiles[8], - """ - new BeforeClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp(cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 62, - }, - """); - - await AssertFileContains(generatedFiles[9], - """ - new BeforeClassHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 68, - }, - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeEachTests.cs b/TUnit.Core.SourceGenerator.Tests/BeforeEachTests.cs index b3524c387a..a318aec097 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeEachTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/BeforeEachTests.cs @@ -13,82 +13,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(14); - - await AssertFileContains(generatedFiles[1], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeEach1", 0, []), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach1()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[3], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeEach2", 0, []), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach2()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[5], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeEach3", 0, []), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach3()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[10], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, []), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup()), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[11], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, [typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup(cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[12], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); - - await AssertFileContains(generatedFiles[13], - """ - new InstanceHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - }, - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt new file mode 100644 index 0000000000..ee4093c9d9 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt @@ -0,0 +1,785 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base1(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeAll1", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base1.BeforeAll1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 5, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeEach1", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base2(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeAll2", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base2.BeforeAll2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 20, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeEach2", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base3(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeAll3", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base3.BeforeAll3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 35, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_Base3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeEach3", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, []), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 50, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 56, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 62, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.IClassHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterClassHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryClassHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeClassHooks(string sessionId) + { + return + [ + new BeforeClassHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 68, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterClassHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_SetupTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs/1432/ConstantInBaseClassTests.cs b/TUnit.Core.SourceGenerator.Tests/Bugs/1432/ConstantInBaseClassTests.cs index 2437daf9fd..86dab57f75 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs/1432/ConstantInBaseClassTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/Bugs/1432/ConstantInBaseClassTests.cs @@ -14,7 +14,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - - await AssertFileContains(generatedFiles[0], "global::System.String methodArg = \"Value\";"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs/1432/ConstantsInInterpolatedStringsTests.cs b/TUnit.Core.SourceGenerator.Tests/Bugs/1432/ConstantsInInterpolatedStringsTests.cs index 0b4a41e13e..36557933c9 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs/1432/ConstantsInInterpolatedStringsTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/Bugs/1432/ConstantsInInterpolatedStringsTests.cs @@ -14,7 +14,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - - await AssertFileContains(generatedFiles[0], "global::System.String methodArg = $\"{\"Value\"}1\";"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs/1432/EnumMemberNamesTests.cs b/TUnit.Core.SourceGenerator.Tests/Bugs/1432/EnumMemberNamesTests.cs index ff8f66c8b1..fd668d0e72 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs/1432/EnumMemberNamesTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/Bugs/1432/EnumMemberNamesTests.cs @@ -14,7 +14,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - - await AssertFileContains(generatedFiles[0], "global::System.String methodArg = \"A\";"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt new file mode 100644 index 0000000000..b9e69887da --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt @@ -0,0 +1,846 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassAndMethodArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("Simple", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "1"; + + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).Simple:0", + TestClassArguments = [classArg], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Simple()), + TestFilePath = @"", + TestLineNumber = 8, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).Simple:0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("Simple", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Simple", + TestFilePath = @"", + TestLineNumber = 8, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("Simple", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "2"; + + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).Simple:0", + TestClassArguments = [classArg], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Simple()), + TestFilePath = @"", + TestLineNumber = 8, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).Simple:0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("Simple", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Simple", + TestFilePath = @"", + TestLineNumber = 8, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassAndMethodArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "1"; + + + global::System.String methodArg = "3"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.WithMethodLevel(methodArg)), + TestFilePath = @"", + TestLineNumber = 11, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("3") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("4") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "WithMethodLevel", + TestFilePath = @"", + TestLineNumber = 11, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "2"; + + + global::System.String methodArg = "3"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.WithMethodLevel(methodArg)), + TestFilePath = @"", + TestLineNumber = 11, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("3") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("4") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "WithMethodLevel", + TestFilePath = @"", + TestLineNumber = 11, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "1"; + + + global::System.String methodArg = "4"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.WithMethodLevel(methodArg)), + TestFilePath = @"", + TestLineNumber = 11, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("3") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("4") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "WithMethodLevel", + TestFilePath = @"", + TestLineNumber = 11, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "2"; + + + global::System.String methodArg = "4"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.WithMethodLevel(methodArg)), + TestFilePath = @"", + TestLineNumber = 11, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("3") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("4") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "WithMethodLevel", + TestFilePath = @"", + TestLineNumber = 11, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassAndMethodArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "1"; + + + global::System.String methodArg = "3"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IgnoreParameters(methodArg)), + TestFilePath = @"", + TestLineNumber = 16, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("3") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("4") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "IgnoreParameters", + TestFilePath = @"", + TestLineNumber = 16, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "2"; + + + global::System.String methodArg = "3"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IgnoreParameters(methodArg)), + TestFilePath = @"", + TestLineNumber = 16, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("3") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("4") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "IgnoreParameters", + TestFilePath = @"", + TestLineNumber = 16, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "1"; + + + global::System.String methodArg = "4"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IgnoreParameters(methodArg)), + TestFilePath = @"", + TestLineNumber = 16, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("3") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("4") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "IgnoreParameters", + TestFilePath = @"", + TestLineNumber = 16, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String classArg = "2"; + + + global::System.String methodArg = "4"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IgnoreParameters(methodArg)), + TestFilePath = @"", + TestLineNumber = 16, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("3") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("4") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ArgumentsAttribute("1") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("2") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", + TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "IgnoreParameters", + TestFilePath = @"", + TestLineNumber = 16, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.cs b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.cs index f59bd65c4d..59d10c03e3 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.cs @@ -12,73 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(3); - - await AssertFileContains(generatedFiles[0], "global::System.String classArg = \"1\";"); - await AssertFileContains(generatedFiles[0], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[0], "classInstance.Simple()"); - await AssertFileContains(generatedFiles[0], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[0], "TestMethodArguments = [],"); - - await AssertFileContains(generatedFiles[0], "global::System.String classArg = \"2\";"); - await AssertFileContains(generatedFiles[0], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[0], "classInstance.Simple()"); - await AssertFileContains(generatedFiles[0], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[0], "TestMethodArguments = [],"); - - await AssertFileContains(generatedFiles[1], "global::System.String classArg = \"1\";"); - await AssertFileContains(generatedFiles[1], "global::System.String methodArg = \"3\";"); - await AssertFileContains(generatedFiles[1], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[1], "classInstance.WithMethodLevel(methodArg)"); - await AssertFileContains(generatedFiles[1], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[1], "TestMethodArguments = [methodArg],"); - - await AssertFileContains(generatedFiles[1], "global::System.String classArg = \"2\";"); - await AssertFileContains(generatedFiles[1], "global::System.String methodArg = \"3\";"); - await AssertFileContains(generatedFiles[1], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[1], "classInstance.WithMethodLevel(methodArg)"); - await AssertFileContains(generatedFiles[1], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[1], "TestMethodArguments = [methodArg],"); - - await AssertFileContains(generatedFiles[1], "global::System.String classArg = \"1\";"); - await AssertFileContains(generatedFiles[1], "global::System.String methodArg = \"4\";"); - await AssertFileContains(generatedFiles[1], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[1], "classInstance.WithMethodLevel(methodArg)"); - await AssertFileContains(generatedFiles[1], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[1], "TestMethodArguments = [methodArg],"); - - await AssertFileContains(generatedFiles[1], "global::System.String classArg = \"2\";"); - await AssertFileContains(generatedFiles[1], "global::System.String methodArg = \"4\";"); - await AssertFileContains(generatedFiles[1], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[1], "classInstance.WithMethodLevel(methodArg)"); - await AssertFileContains(generatedFiles[1], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[1], "TestMethodArguments = [methodArg],"); - - await AssertFileContains(generatedFiles[2], "global::System.String classArg = \"1\";"); - await AssertFileContains(generatedFiles[2], "global::System.String methodArg = \"3\";"); - await AssertFileContains(generatedFiles[2], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[2], "classInstance.IgnoreParameters(methodArg)"); - await AssertFileContains(generatedFiles[2], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[2], "TestMethodArguments = [methodArg],"); - - await AssertFileContains(generatedFiles[2], "global::System.String classArg = \"2\";"); - await AssertFileContains(generatedFiles[2], "global::System.String methodArg = \"3\";"); - await AssertFileContains(generatedFiles[2], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[2], "classInstance.IgnoreParameters(methodArg)"); - await AssertFileContains(generatedFiles[2], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[2], "TestMethodArguments = [methodArg],"); - - await AssertFileContains(generatedFiles[2], "global::System.String classArg = \"1\";"); - await AssertFileContains(generatedFiles[2], "global::System.String methodArg = \"4\";"); - await AssertFileContains(generatedFiles[2], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[2], "classInstance.IgnoreParameters(methodArg)"); - await AssertFileContains(generatedFiles[2], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[2], "TestMethodArguments = [methodArg],"); - - await AssertFileContains(generatedFiles[2], "global::System.String classArg = \"2\";"); - await AssertFileContains(generatedFiles[2], "global::System.String methodArg = \"4\";"); - await AssertFileContains(generatedFiles[2], "new global::TUnit.TestProject.ClassAndMethodArgumentsTests(classArg)"); - await AssertFileContains(generatedFiles[2], "classInstance.IgnoreParameters(methodArg)"); - await AssertFileContains(generatedFiles[2], "TestClassArguments = [classArg],"); - await AssertFileContains(generatedFiles[2], "TestMethodArguments = [methodArg],"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt new file mode 100644 index 0000000000..4ae457ce92 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt @@ -0,0 +1,88 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassConstructorTest : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassConstructorTest()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassConstructorTest); + var methodInfo = typeof(global::TUnit.TestProject.ClassConstructorTest).GetMethod("Test", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassConstructorAttribute:{classDataIndex}:CL-CCA0:TUnit.TestProject.ClassConstructorTest(TUnit.TestProject.DummyReferenceTypeClass).Test:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test()), + TestFilePath = @"", + TestLineNumber = 8, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ClassConstructorAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassConstructorAttribute:{classDataIndex}:CL-CCA0:TUnit.TestProject.ClassConstructorTest(TUnit.TestProject.DummyReferenceTypeClass).Test:0", + TestClass = typeof(global::TUnit.TestProject.ClassConstructorTest), + ReturnType = typeof(global::TUnit.TestProject.ClassConstructorTest).GetMethod("Test", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Test", + TestFilePath = @"", + TestLineNumber = 8, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.cs b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.cs index a3b1c8d6e3..97909c972a 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.cs +++ b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.cs @@ -25,7 +25,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - await AssertFileContains(generatedFiles[0], "var resettableClassFactoryDelegate = () => new ResettableLazy(sessionId, testBuilderContext);"); - await AssertFileContains(generatedFiles[0], "var resettableClassFactory = resettableClassFactoryDelegate();"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt new file mode 100644 index 0000000000..5528786ae5 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt @@ -0,0 +1,768 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class(TUnit.TestProject.Dummy.SomeAsyncDisposableClass):0", + TestClassArguments = [], + TestMethodArguments = [methodArgGeneratedData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Class(methodArgGeneratedData)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class(TUnit.TestProject.Dummy.SomeAsyncDisposableClass):0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)], + TestName = "DataSource_Class", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class_Generic", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic(TUnit.TestProject.Dummy.SomeAsyncDisposableClass):0", + TestClassArguments = [], + TestMethodArguments = [methodArgGeneratedData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Class_Generic(methodArgGeneratedData)), + TestFilePath = @"", + TestLineNumber = 17, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic(TUnit.TestProject.Dummy.SomeAsyncDisposableClass):0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class_Generic", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)], + TestName = "DataSource_Class_Generic", + TestFilePath = @"", + TestLineNumber = 17, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_1_ClassDataSource", 0, [typeof(global::TUnit.TestProject.InitializableClass)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource(TUnit.TestProject.InitializableClass):0", + TestClassArguments = [], + TestMethodArguments = [methodArgGeneratedData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IsInitialized_With_1_ClassDataSource(methodArgGeneratedData)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource(TUnit.TestProject.InitializableClass):0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_1_ClassDataSource", 0, [typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass)], + TestName = "IsInitialized_With_1_ClassDataSource", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + global::TUnit.TestProject.InitializableClass methodArg = methodArgGeneratedData.Item1; + global::TUnit.TestProject.InitializableClass methodArg1 = methodArgGeneratedData.Item2; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IsInitialized_With_2_ClassDataSources(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 31, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)], + TestName = "IsInitialized_With_2_ClassDataSources", + TestFilePath = @"", + TestLineNumber = 31, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + global::TUnit.TestProject.InitializableClass methodArg = methodArgGeneratedData.Item1; + global::TUnit.TestProject.InitializableClass methodArg1 = methodArgGeneratedData.Item2; + global::TUnit.TestProject.InitializableClass methodArg2 = methodArgGeneratedData.Item3; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IsInitialized_With_3_ClassDataSources(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 39, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)], + TestName = "IsInitialized_With_3_ClassDataSources", + TestFilePath = @"", + TestLineNumber = 39, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + global::TUnit.TestProject.InitializableClass methodArg = methodArgGeneratedData.Item1; + global::TUnit.TestProject.InitializableClass methodArg1 = methodArgGeneratedData.Item2; + global::TUnit.TestProject.InitializableClass methodArg2 = methodArgGeneratedData.Item3; + global::TUnit.TestProject.InitializableClass methodArg3 = methodArgGeneratedData.Item4; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IsInitialized_With_4_ClassDataSources(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 48, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)], + TestName = "IsInitialized_With_4_ClassDataSources", + TestFilePath = @"", + TestLineNumber = 48, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + global::TUnit.TestProject.InitializableClass methodArg = methodArgGeneratedData.Item1; + global::TUnit.TestProject.InitializableClass methodArg1 = methodArgGeneratedData.Item2; + global::TUnit.TestProject.InitializableClass methodArg2 = methodArgGeneratedData.Item3; + global::TUnit.TestProject.InitializableClass methodArg3 = methodArgGeneratedData.Item4; + global::TUnit.TestProject.InitializableClass methodArg4 = methodArgGeneratedData.Item5; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3, methodArg4], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IsInitialized_With_5_ClassDataSources(methodArg, methodArg1, methodArg2, methodArg3, methodArg4)), + TestFilePath = @"", + TestLineNumber = 58, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)], + TestName = "IsInitialized_With_5_ClassDataSources", + TestFilePath = @"", + TestLineNumber = 58, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.cs b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.cs index 865a48e7f5..7b48d054f4 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.cs @@ -23,35 +23,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(7); - - await AssertFileContains(generatedFiles[0], "var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[0], """ - var methodArgDataGeneratorMetadata = new DataGeneratorMetadata - { - Type = TUnit.Core.Enums.DataGeneratorType.Parameters, - TestClassType = testClassType, - ParameterInfos = methodInfo.GetParameters(), - PropertyInfo = null, - TestBuilderContext = testBuilderContextAccessor, - TestSessionId = sessionId, - }; - """); - await AssertFileContains(generatedFiles[0], "var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata);"); - await AssertFileContains(generatedFiles[0], "classInstance.DataSource_Class(methodArgGeneratedData)"); - - await AssertFileContains(generatedFiles[1], "var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[1], """ - var methodArgDataGeneratorMetadata = new DataGeneratorMetadata - { - Type = TUnit.Core.Enums.DataGeneratorType.Parameters, - TestClassType = testClassType, - ParameterInfos = methodInfo.GetParameters(), - PropertyInfo = null, - TestBuilderContext = testBuilderContextAccessor, - TestSessionId = sessionId, - }; - """); - await AssertFileContains(generatedFiles[1], "var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata);"); - await AssertFileContains(generatedFiles[1], "classInstance.DataSource_Class_Generic(methodArgGeneratedData)"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt new file mode 100644 index 0000000000..6ae214cf19 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt @@ -0,0 +1,399 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTests2()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived1", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetCustomAttributes>(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests2(classArgGeneratedData) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived1:0", + TestClassArguments = [classArgGeneratedData], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Base_Derived1()), + TestFilePath = @"", + TestLineNumber = 9, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived1:0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived1", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Base_Derived1", + TestFilePath = @"", + TestLineNumber = 9, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived1", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetCustomAttributes>(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests2(classArgGeneratedData) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived1:0", + TestClassArguments = [classArgGeneratedData], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Base_Derived1()), + TestFilePath = @"", + TestLineNumber = 9, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived1:0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived1", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Base_Derived1", + TestFilePath = @"", + TestLineNumber = 9, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTests2()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived2", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetCustomAttributes>(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests2(classArgGeneratedData) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived2:0", + TestClassArguments = [classArgGeneratedData], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Base_Derived2()), + TestFilePath = @"", + TestLineNumber = 15, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived2:0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived2", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Base_Derived2", + TestFilePath = @"", + TestLineNumber = 15, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived2", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetCustomAttributes>(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTests2(classArgGeneratedData) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived2:0", + TestClassArguments = [classArgGeneratedData], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Base_Derived2()), + TestFilePath = @"", + TestLineNumber = 15, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived2:0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived2", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Base_Derived2", + TestFilePath = @"", + TestLineNumber = 15, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.cs b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.cs index 87ee7a4280..c22ce2ed82 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.cs +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.cs @@ -12,21 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles).HasCount().EqualTo(2); - - await AssertFileContains(generatedFiles[0], "var classDataAttribute = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[0], """ - var classArgDataGeneratorMetadata = new DataGeneratorMetadata - { - Type = TUnit.Core.Enums.DataGeneratorType.Parameters, - TestClassType = testClassType, - ParameterInfos = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructors().First().GetParameters(), - PropertyInfo = null, - TestBuilderContext = testBuilderContextAccessor, - TestSessionId = sessionId, - }; - """); - await AssertFileContains(generatedFiles[0], "var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata);"); - await AssertFileContains(generatedFiles[0], - "var resettableClassFactoryDelegate = () => new ResettableLazy(() => new global::TUnit.TestProject.ClassDataSourceDrivenTests2(classArgGeneratedData), sessionId, testBuilderContext);"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt new file mode 100644 index 0000000000..1af0060d26 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt @@ -0,0 +1,215 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTestsSharedKeyed : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTestsSharedKeyed()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class", 0, [typeof(SomeAsyncDisposableClass)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class(SomeAsyncDisposableClass):0", + TestClassArguments = [], + TestMethodArguments = [methodArgGeneratedData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Class(methodArgGeneratedData)), + TestFilePath = @"", + TestLineNumber = 7, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.Keyed, Key = "🔑", +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class(SomeAsyncDisposableClass):0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class", 0, [typeof(SomeAsyncDisposableClass)]).ReturnType, + ParameterTypeFullNames = [typeof(SomeAsyncDisposableClass)], + TestName = "DataSource_Class", + TestFilePath = @"", + TestLineNumber = 7, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassDataSourceDrivenTestsSharedKeyed : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassDataSourceDrivenTestsSharedKeyed()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed); + var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", 0, [typeof(SomeAsyncDisposableClass)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic(SomeAsyncDisposableClass):0", + TestClassArguments = [], + TestMethodArguments = [methodArgGeneratedData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Class_Generic(methodArgGeneratedData)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.Keyed, Key = "🔑", +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic(SomeAsyncDisposableClass):0", + TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), + ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", 0, [typeof(SomeAsyncDisposableClass)]).ReturnType, + ParameterTypeFullNames = [typeof(SomeAsyncDisposableClass)], + TestName = "DataSource_Class_Generic", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.cs b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.cs new file mode 100644 index 0000000000..fad137b147 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.cs @@ -0,0 +1,16 @@ +using TUnit.Assertions.Extensions; +using TUnit.Core.SourceGenerator.CodeGenerators; + +namespace TUnit.Core.SourceGenerator.Tests; + +internal class ClassDataSourceDrivenTestsSharedKeyed : TestsBase +{ + [Test] + public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, + "TUnit.TestProject", + "ClassDataSourceDrivenTestsSharedKeyed.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles.Length).IsEqualTo(2); + }); +} \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=NamedTupleMethod_testMethodName=NamedTupleMethod.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=NamedTupleMethod_testMethodName=NamedTupleMethod.verified.txt new file mode 100644 index 0000000000..499e985a6f --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=NamedTupleMethod_testMethodName=NamedTupleMethod.verified.txt @@ -0,0 +1,396 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassTupleDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassTupleDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=NamedTupleMethod_testMethodName=TupleMethod.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=NamedTupleMethod_testMethodName=TupleMethod.verified.txt new file mode 100644 index 0000000000..499e985a6f --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=NamedTupleMethod_testMethodName=TupleMethod.verified.txt @@ -0,0 +1,396 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassTupleDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassTupleDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=TupleMethod_testMethodName=NamedTupleMethod.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=TupleMethod_testMethodName=NamedTupleMethod.verified.txt new file mode 100644 index 0000000000..499e985a6f --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=TupleMethod_testMethodName=NamedTupleMethod.verified.txt @@ -0,0 +1,396 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassTupleDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassTupleDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=TupleMethod_testMethodName=TupleMethod.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=TupleMethod_testMethodName=TupleMethod.verified.txt new file mode 100644 index 0000000000..499e985a6f --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test_index=0_classMethodName=TupleMethod_testMethodName=TupleMethod.verified.txt @@ -0,0 +1,396 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassTupleDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassTupleDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.cs b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.cs index 056d80c226..7c248318f6 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.cs @@ -5,34 +5,17 @@ namespace TUnit.Core.SourceGenerator.Tests; internal class ClassTupleDataSourceDrivenTests : TestsBase { - [TestCase(0, "TupleMethod", "TupleMethod")] - [TestCase(0, "NamedTupleMethod", "TupleMethod")] - [TestCase(0, "TupleMethod", "NamedTupleMethod")] - [TestCase(0, "NamedTupleMethod", "NamedTupleMethod")] + [Test] + [Arguments(0, "TupleMethod", "TupleMethod")] + [Arguments(0, "NamedTupleMethod", "TupleMethod")] + [Arguments(0, "TupleMethod", "NamedTupleMethod")] + [Arguments(0, "NamedTupleMethod", "NamedTupleMethod")] public Task Test(int index, string classMethodName, string testMethodName) => RunTest(Path.Combine(Git.RootDirectory.FullName, "TUnit.TestProject", "ClassTupleDataSourceDrivenTests.cs"), async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - - await AssertFileContains(generatedFiles[index], $"var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.{classMethodName}()());"); - await AssertFileContains(generatedFiles[index], "global::System.Int32 classArg = classArgTuples.Item1;"); - await AssertFileContains(generatedFiles[index], "global::System.String classArg1 = classArgTuples.Item2;"); - await AssertFileContains(generatedFiles[index], "global::System.Boolean classArg2 = classArgTuples.Item3;"); - await AssertFileContains(generatedFiles[index], "var resettableClassFactoryDelegate = () => new ResettableLazy(() => new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2)\t\t\t{\n\t\t\t\tProperty1 = propertyArg,\n\t\t\t\tProperty2 = propertyArg1,\n\t\t\t\tProperty3 = propertyArg2,\n\t\t\t\tProperty4 = propertyArg3,\n\t\t\t}\n, sessionId, testBuilderContext);"); - - await AssertFileContains(generatedFiles[index], $"var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.{testMethodName}()());"); - await AssertFileContains(generatedFiles[index], "global::System.Int32 methodArg = methodArgTuples.Item1;"); - await AssertFileContains(generatedFiles[index], "global::System.String methodArg1 = methodArgTuples.Item2;"); - await AssertFileContains(generatedFiles[index], "global::System.Boolean methodArg2 = methodArgTuples.Item3;"); - - await AssertFileContains(generatedFiles[index], "TestMethodArguments = [methodArg, methodArg1, methodArg2],"); - await AssertFileContains(generatedFiles[index], - "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2))"); - - await AssertFileContains(generatedFiles[index], "(global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()();"); - await AssertFileContains(generatedFiles[index], "(global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()();"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt new file mode 100644 index 0000000000..d85e2235e4 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt @@ -0,0 +1,274 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConcreteClass2()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.AbstractTests.ConcreteClass2() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.SecondTest()), + TestFilePath = @"", + TestLineNumber = 11, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +}, new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest:0", + TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "SecondTest", + TestFilePath = @"", + TestLineNumber = 11, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Inherited_ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new Inherited_ConcreteClass2()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.AbstractTests.ConcreteClass2() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AssertClassName()), + TestFilePath = @"", + TestLineNumber = 8, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +}, new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName:0", + TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "AssertClassName", + TestFilePath = @"", + TestLineNumber = 8, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new Inherited_ConcreteClass1()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); + var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.AbstractTests.ConcreteClass1() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AssertClassName()), + TestFilePath = @"", + TestLineNumber = 8, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", + TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), + ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "AssertClassName", + TestFilePath = @"", + TestLineNumber = 8, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.cs b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.cs index c96d5e06cf..7dde781270 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.cs @@ -29,14 +29,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(3); - - await AssertFileContains(generatedFiles[1], "TestId = $\"TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName:0\","); - await AssertFileContains(generatedFiles[1], "var resettableClassFactoryDelegate = () => new ResettableLazy(() => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), sessionId, testBuilderContext);"); - - await AssertFileContains(generatedFiles[0], "TestId = $\"TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest:0\","); - await AssertFileContains(generatedFiles[0], "var resettableClassFactoryDelegate = () => new ResettableLazy(() => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), sessionId, testBuilderContext);"); - - await AssertFileContains(generatedFiles[2], "TestId = $\"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0\","); - await AssertFileContains(generatedFiles[2], "var resettableClassFactoryDelegate = () => new ResettableLazy(() => new global::TUnit.TestProject.AbstractTests.ConcreteClass1(), sessionId, testBuilderContext);"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt new file mode 100644 index 0000000000..adb24e0908 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt @@ -0,0 +1,638 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConstantArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("String1", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "123"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ConstantArgumentsTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.String1(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.String1(methodArg)), + TestFilePath = @"", + TestLineNumber = 16, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("123") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.String1(System.String):0", + TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("String1", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "String1", + TestFilePath = @"", + TestLineNumber = 16, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConstantArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Int", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 123; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ConstantArgumentsTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Int(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Int(methodArg)), + TestFilePath = @"", + TestLineNumber = 23, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(123) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Int(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Int", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "Int", + TestFilePath = @"", + TestLineNumber = 23, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConstantArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Double", 0, [typeof(global::System.Double)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Double methodArg = 1.23; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ConstantArgumentsTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Double(System.Double):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Double(methodArg)), + TestFilePath = @"", + TestLineNumber = 30, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1.23) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Double(System.Double):0", + TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Double", 0, [typeof(global::System.Double)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Double)], + TestName = "Double", + TestFilePath = @"", + TestLineNumber = 30, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConstantArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Float", 0, [typeof(global::System.Single)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Single methodArg = 1.23F; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ConstantArgumentsTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Float(System.Single):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Float(methodArg)), + TestFilePath = @"", + TestLineNumber = 37, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1.23F) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Float(System.Single):0", + TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Float", 0, [typeof(global::System.Single)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Single)], + TestName = "Float", + TestFilePath = @"", + TestLineNumber = 37, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConstantArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Long", 0, [typeof(global::System.Int64)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int64 methodArg = 123L; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ConstantArgumentsTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Long(System.Int64):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Long(methodArg)), + TestFilePath = @"", + TestLineNumber = 44, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(123L) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Long(System.Int64):0", + TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Long", 0, [typeof(global::System.Int64)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int64)], + TestName = "Long", + TestFilePath = @"", + TestLineNumber = 44, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConstantArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.UInt32 methodArg = 123U; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ConstantArgumentsTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.UInt(System.UInt32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.UInt(methodArg)), + TestFilePath = @"", + TestLineNumber = 51, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(123U) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.UInt(System.UInt32):0", + TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.UInt32)], + TestName = "UInt", + TestFilePath = @"", + TestLineNumber = 51, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConstantArgumentsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); + var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.UInt64 methodArg = 123UL; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ConstantArgumentsTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.ULong(System.UInt64):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.ULong(methodArg)), + TestFilePath = @"", + TestLineNumber = 58, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(123UL) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.ULong(System.UInt64):0", + TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.UInt64)], + TestName = "ULong", + TestFilePath = @"", + TestLineNumber = 58, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.cs b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.cs index 9786d9afb6..5c8303e8cd 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.cs @@ -12,26 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(7); - - await AssertFileContains(generatedFiles[0], - "global::System.String methodArg = \"123\";"); - - await AssertFileContains(generatedFiles[1], - "global::System.Int32 methodArg = 123;"); - - await AssertFileContains(generatedFiles[2], - "global::System.Double methodArg = 1.23;"); - - await AssertFileContains(generatedFiles[3], - "global::System.Single methodArg = 1.23F;"); - - await AssertFileContains(generatedFiles[4], - "global::System.Int64 methodArg = 123L;"); - - await AssertFileContains(generatedFiles[5], - "global::System.UInt32 methodArg = 123U;"); - - await AssertFileContains(generatedFiles[6], - "global::System.UInt64 methodArg = 123UL;"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt new file mode 100644 index 0000000000..44ef473cf1 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt @@ -0,0 +1,92 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConstantInBaseClassTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConstantInBaseClassTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests); + var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "Value"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests.SomeTest(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.SomeTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 13, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("Value") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests.SomeTest(System.String):0", + TestClass = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), + ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "SomeTest", + TestFilePath = @"", + TestLineNumber = 13, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt new file mode 100644 index 0000000000..eb201d5662 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt @@ -0,0 +1,92 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ConstantsInInterpolatedStringsTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ConstantsInInterpolatedStringsTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests); + var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = $"{"Value"}1"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests.SomeTest(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.SomeTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 13, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute($"{"Value"}1") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests.SomeTest(System.String):0", + TestClass = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), + ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "SomeTest", + TestFilePath = @"", + TestLineNumber = 13, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt new file mode 100644 index 0000000000..bc3d1ff3f6 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt @@ -0,0 +1,1534 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(2) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(3) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(2) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(3) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 3; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(2) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(3) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.String methodArg1 = "String"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32,System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(2) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(3) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32,System.String):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String)], + TestName = "DataSource_Method", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.String methodArg1 = "String2"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32,System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(2) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(3) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32,System.String):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String)], + TestName = "DataSource_Method", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 3; + global::System.String methodArg1 = "String3"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32,System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(2) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(3) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32,System.String):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String)], + TestName = "DataSource_Method", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::TUnit.TestProject.TestEnum methodArg = global::TUnit.TestProject.TestEnum.One; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.EnumValue(TUnit.TestProject.TestEnum):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.EnumValue(methodArg)), + TestFilePath = @"", + TestLineNumber = 23, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(-1) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.EnumValue(TUnit.TestProject.TestEnum):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.TestEnum)], + TestName = "EnumValue", + TestFilePath = @"", + TestLineNumber = 23, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::TUnit.TestProject.TestEnum methodArg = global::TUnit.TestProject.TestEnum.Two; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.EnumValue(TUnit.TestProject.TestEnum):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.EnumValue(methodArg)), + TestFilePath = @"", + TestLineNumber = 23, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(-1) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.EnumValue(TUnit.TestProject.TestEnum):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.TestEnum)], + TestName = "EnumValue", + TestFilePath = @"", + TestLineNumber = 23, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::TUnit.TestProject.TestEnum methodArg = (global::TUnit.TestProject.TestEnum)(-1); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.EnumValue(TUnit.TestProject.TestEnum):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.EnumValue(methodArg)), + TestFilePath = @"", + TestLineNumber = 23, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(-1) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.EnumValue(TUnit.TestProject.TestEnum):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.TestEnum)], + TestName = "EnumValue", + TestFilePath = @"", + TestLineNumber = 23, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = null; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.NullValue(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.NullValue(methodArg)), + TestFilePath = @"", + TestLineNumber = 32, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.NullValue(System.String):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "NullValue", + TestFilePath = @"", + TestLineNumber = 32, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = ""; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.EmptyString(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.EmptyString(methodArg)), + TestFilePath = @"", + TestLineNumber = 39, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.EmptyString(System.String):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "EmptyString", + TestFilePath = @"", + TestLineNumber = 39, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "Foo bar!"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.NonEmptyString(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.NonEmptyString(methodArg)), + TestFilePath = @"", + TestLineNumber = 46, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("Foo bar!") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.NonEmptyString(System.String):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "NonEmptyString", + TestFilePath = @"", + TestLineNumber = 46, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Boolean? methodArg = null; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.BooleanString(System.Boolean?):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.BooleanString(methodArg)), + TestFilePath = @"", + TestLineNumber = 53, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(false) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(true) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.BooleanString(System.Boolean?):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Boolean?)], + TestName = "BooleanString", + TestFilePath = @"", + TestLineNumber = 53, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Boolean? methodArg = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.BooleanString(System.Boolean?):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.BooleanString(methodArg)), + TestFilePath = @"", + TestLineNumber = 53, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(false) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(true) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.BooleanString(System.Boolean?):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Boolean?)], + TestName = "BooleanString", + TestFilePath = @"", + TestLineNumber = 53, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Boolean? methodArg = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.BooleanString(System.Boolean?):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.BooleanString(methodArg)), + TestFilePath = @"", + TestLineNumber = 53, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(false) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(true) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.BooleanString(System.Boolean?):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Boolean?)], + TestName = "BooleanString", + TestFilePath = @"", + TestLineNumber = 53, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", 0, [typeof(global::System.Type)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Type methodArg = typeof(global::System.Object); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.Type(System.Type):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Type(methodArg)), + TestFilePath = @"", + TestLineNumber = 62, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(typeof(global::System.Object)) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.Type(System.Type):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", 0, [typeof(global::System.Type)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Type)], + TestName = "Type", + TestFilePath = @"", + TestLineNumber = 62, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", 0, [typeof(global::System.Int32[])]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32[] methodArg = new[] { 1, 2, 3 }; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.IntegerArray(System.Int32[]):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IntegerArray(methodArg)), + TestFilePath = @"", + TestLineNumber = 69, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.IntegerArray(System.Int32[]):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", 0, [typeof(global::System.Int32[])]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32[])], + TestName = "IntegerArray", + TestFilePath = @"", + TestLineNumber = 69, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::System.Int32.MaxValue; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.IntMaxValue(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.IntMaxValue(methodArg)), + TestFilePath = @"", + TestLineNumber = 76, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(global::System.Int32.MaxValue) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.IntMaxValue(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "IntMaxValue", + TestFilePath = @"", + TestLineNumber = 76, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.cs b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.cs index 0f7c5b9478..50e144d061 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.cs @@ -22,36 +22,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(10); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = 1;"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = 2;"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = 3;"); - - await AssertFileContains(generatedFiles[1], "global::System.Int32 methodArg = 1;"); - await AssertFileContains(generatedFiles[1], "global::System.String methodArg1 = \"String\";"); - await AssertFileContains(generatedFiles[1], "global::System.Int32 methodArg = 2;"); - await AssertFileContains(generatedFiles[1], "global::System.String methodArg1 = \"String2\";"); - await AssertFileContains(generatedFiles[1], "global::System.Int32 methodArg = 3;"); - await AssertFileContains(generatedFiles[1], "global::System.String methodArg1 = \"String3\";"); - - await AssertFileContains(generatedFiles[2], "global::TUnit.TestProject.TestEnum methodArg = global::TUnit.TestProject.TestEnum.One;"); - await AssertFileContains(generatedFiles[2], "global::TUnit.TestProject.TestEnum methodArg = global::TUnit.TestProject.TestEnum.Two;"); - await AssertFileContains(generatedFiles[2], "global::TUnit.TestProject.TestEnum methodArg = (global::TUnit.TestProject.TestEnum)(-1);"); - - await AssertFileContains(generatedFiles[3], "global::System.String methodArg = null;"); - - await AssertFileContains(generatedFiles[4], "global::System.String methodArg = \"\";"); - - await AssertFileContains(generatedFiles[5], "global::System.String methodArg = \"Foo bar!\";"); - - await AssertFileContains(generatedFiles[6], "global::System.Boolean? methodArg = null;"); - await AssertFileContains(generatedFiles[6], "global::System.Boolean? methodArg = false;"); - await AssertFileContains(generatedFiles[6], "global::System.Boolean? methodArg = true;"); - - await AssertFileContains(generatedFiles[7], "global::System.Type methodArg = typeof(global::System.Object);"); - - await AssertFileContains(generatedFiles[8], "global::System.Int32[] methodArg = new[] { 1, 2, 3 };"); - - await AssertFileContains(generatedFiles[9], "global::System.Int32 methodArg = global::System.Int32.MaxValue;"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt new file mode 100644 index 0000000000..72aa8eac14 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt @@ -0,0 +1,766 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataSourceClassCombinedWithDataSourceMethod()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ..Tests4(sessionId), + ..Tests5(sessionId), + ..Tests6(sessionId), + ..Tests7(sessionId), + ..Tests8(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.One(); + + global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.One(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceClassCombinedWithDataSourceMethodTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Two(); + + global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.One(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceClassCombinedWithDataSourceMethodTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Three(); + + global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.One(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS2:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceClassCombinedWithDataSourceMethodTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS2:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.One(); + + global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Two(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceClassCombinedWithDataSourceMethodTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests4(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Two(); + + global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Two(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceClassCombinedWithDataSourceMethodTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests5(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Three(); + + global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Two(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS2:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceClassCombinedWithDataSourceMethodTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS2:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests6(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.One(); + + global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Three(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceClassCombinedWithDataSourceMethodTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests7(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Two(); + + global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Three(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceClassCombinedWithDataSourceMethodTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests8(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Three(); + + global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Three(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS2:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceClassCombinedWithDataSourceMethodTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS2:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.cs b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.cs index 9c8c1c0224..4bae3c456c 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.cs @@ -22,32 +22,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.One();"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.One();"); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Two();"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.One();"); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Three();"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.One();"); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.One();"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Two();"); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Two();"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Two();"); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Three();"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Two();"); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.One();"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Three();"); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Two();"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Three();"); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 classArg = global::TUnit.TestProject.CommonTestData.Three();"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.CommonTestData.Three();"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Test.verified.txt new file mode 100644 index 0000000000..562e1573c8 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Test.verified.txt @@ -0,0 +1,764 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataSourceGeneratorTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes>(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + global::System.Int32 classArg = classArgGeneratedData.Item1; + global::System.String classArg1 = classArgGeneratedData.Item2; + global::System.Boolean classArg2 = classArgGeneratedData.Item3; + + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceGeneratorTests(classArg, classArg1, classArg2) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method(System.Int32):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArgGeneratedData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.GeneratedData_Method(methodArgGeneratedData)), + TestFilePath = @"", + TestLineNumber = 9, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute, methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "GeneratedData_Method", + TestFilePath = @"", + TestLineNumber = 9, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + global::System.Int32 classArg = classArgGeneratedData.Item1; + global::System.String classArg1 = classArgGeneratedData.Item2; + global::System.Boolean classArg2 = classArgGeneratedData.Item3; + + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceGeneratorTests(classArg, classArg1, classArg2) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method(System.Int32):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArgGeneratedData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.GeneratedData_Method(methodArgGeneratedData)), + TestFilePath = @"", + TestLineNumber = 9, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute, methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "GeneratedData_Method", + TestFilePath = @"", + TestLineNumber = 9, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataSourceGeneratorTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes>(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + global::System.Int32 classArg = classArgGeneratedData.Item1; + global::System.String classArg1 = classArgGeneratedData.Item2; + global::System.Boolean classArg2 = classArgGeneratedData.Item3; + + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + global::System.Int32 methodArg = methodArgGeneratedData.Item1; + global::System.String methodArg1 = methodArgGeneratedData.Item2; + global::System.Boolean methodArg2 = methodArgGeneratedData.Item3; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceGeneratorTests(classArg, classArg1, classArg2) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method2(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.GeneratedData_Method2(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 17, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute, methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method2(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "GeneratedData_Method2", + TestFilePath = @"", + TestLineNumber = 17, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + global::System.Int32 classArg = classArgGeneratedData.Item1; + global::System.String classArg1 = classArgGeneratedData.Item2; + global::System.Boolean classArg2 = classArgGeneratedData.Item3; + + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + global::System.Int32 methodArg = methodArgGeneratedData.Item1; + global::System.String methodArg1 = methodArgGeneratedData.Item2; + global::System.Boolean methodArg2 = methodArgGeneratedData.Item3; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceGeneratorTests(classArg, classArg1, classArg2) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method2(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.GeneratedData_Method2(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 17, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute, methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method2(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "GeneratedData_Method2", + TestFilePath = @"", + TestLineNumber = 17, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new DataSourceGeneratorTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes>(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + global::System.Int32 classArg = classArgGeneratedData.Item1; + global::System.String classArg1 = classArgGeneratedData.Item2; + global::System.Boolean classArg2 = classArgGeneratedData.Item3; + + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + global::System.Int32 methodArg = methodArgGeneratedData.Item1; + global::System.String methodArg1 = methodArgGeneratedData.Item2; + global::System.Boolean methodArg2 = methodArgGeneratedData.Item3; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceGeneratorTests(classArg, classArg1, classArg2) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method3(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.GeneratedData_Method3(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 25, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute, methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method3(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "GeneratedData_Method3", + TestFilePath = @"", + TestLineNumber = 25, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); + var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var methodArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = methodInfo.GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var methodDataAttribute = methodInfo.GetCustomAttributes(true).ElementAt(0); + + var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); + + foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray) + { + testMethodDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + global::System.Int32 classArg = classArgGeneratedData.Item1; + global::System.String classArg1 = classArgGeneratedData.Item2; + global::System.Boolean classArg2 = classArgGeneratedData.Item3; + + + var methodArgGeneratedData = methodArgGeneratedDataAccessor(); + global::System.Int32 methodArg = methodArgGeneratedData.Item1; + global::System.String methodArg1 = methodArgGeneratedData.Item2; + global::System.Boolean methodArg2 = methodArgGeneratedData.Item3; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.DataSourceGeneratorTests(classArg, classArg1, classArg2) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method3(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.GeneratedData_Method3(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 25, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}, new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute, methodDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method3(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "GeneratedData_Method3", + TestFilePath = @"", + TestLineNumber = 25, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.cs b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.cs index ae1393c0de..b968f6e4a1 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.cs @@ -12,62 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(3); - - await AssertFileContains(generatedFiles[0], "TestId = $\"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method(System.Int32):0\""); - await AssertFileContains(generatedFiles[0], "var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[0], """ - var methodArgDataGeneratorMetadata = new DataGeneratorMetadata - { - Type = TUnit.Core.Enums.DataGeneratorType.Parameters, - TestClassType = testClassType, - ParameterInfos = methodInfo.GetParameters(), - PropertyInfo = null, - TestBuilderContext = testBuilderContextAccessor, - TestSessionId = sessionId, - }; - """); - await AssertFileContains(generatedFiles[0], "var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata);"); - await AssertFileContains(generatedFiles[0], "foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray)"); - await AssertFileContains(generatedFiles[0], "classInstance.GeneratedData_Method(methodArgGeneratedData))"); - - await AssertFileContains(generatedFiles[1], "TestId = $\"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method2(System.Int32,System.String,System.Boolean):0\","); - await AssertFileContains(generatedFiles[1], "var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[1], """ - var methodArgDataGeneratorMetadata = new DataGeneratorMetadata - { - Type = TUnit.Core.Enums.DataGeneratorType.Parameters, - TestClassType = testClassType, - ParameterInfos = methodInfo.GetParameters(), - PropertyInfo = null, - TestBuilderContext = testBuilderContextAccessor, - TestSessionId = sessionId, - }; - """); - await AssertFileContains(generatedFiles[1], "var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata);"); - await AssertFileContains(generatedFiles[1], "foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray)"); - await AssertFileContains(generatedFiles[1], "global::System.Int32 methodArg = methodArgGeneratedData.Item1;"); - await AssertFileContains(generatedFiles[1], "global::System.String methodArg1 = methodArgGeneratedData.Item2;"); - await AssertFileContains(generatedFiles[1], "global::System.Boolean methodArg2 = methodArgGeneratedData.Item3;"); - await AssertFileContains(generatedFiles[1], "classInstance.GeneratedData_Method2(methodArg, methodArg1, methodArg2)"); - - await AssertFileContains(generatedFiles[2], "TestId = $\"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method3(System.Int32,System.String,System.Boolean):0\","); - await AssertFileContains(generatedFiles[2], "var methodDataAttribute = methodInfo.GetCustomAttributes(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[2], """ - var methodArgDataGeneratorMetadata = new DataGeneratorMetadata - { - Type = TUnit.Core.Enums.DataGeneratorType.Parameters, - TestClassType = testClassType, - ParameterInfos = methodInfo.GetParameters(), - PropertyInfo = null, - TestBuilderContext = testBuilderContextAccessor, - TestSessionId = sessionId, - }; - """); - await AssertFileContains(generatedFiles[2], "var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata);"); - await AssertFileContains(generatedFiles[2], "foreach (var methodArgGeneratedDataAccessor in methodArgGeneratedDataArray)"); - await AssertFileContains(generatedFiles[2], "global::System.Int32 methodArg = methodArgGeneratedData.Item1;"); - await AssertFileContains(generatedFiles[2], "global::System.String methodArg1 = methodArgGeneratedData.Item2;"); - await AssertFileContains(generatedFiles[2], "global::System.Boolean methodArg2 = methodArgGeneratedData.Item3;"); - await AssertFileContains(generatedFiles[2], "classInstance.GeneratedData_Method3(methodArg, methodArg1, methodArg2)"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt new file mode 100644 index 0000000000..6c4c098295 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt @@ -0,0 +1,247 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class EnumMemberNamesTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new EnumMemberNamesTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests); + var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "A"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.SomeTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("A") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("B") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("C") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest(System.String):0", + TestClass = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), + ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "SomeTest", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests); + var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "B"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.SomeTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("A") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("B") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("C") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest(System.String):0", + TestClass = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), + ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "SomeTest", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests); + var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "C"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.SomeTest(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("A") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("B") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("C") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest(System.String):0", + TestClass = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), + ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "SomeTest", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt new file mode 100644 index 0000000000..221e9be00e --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt @@ -0,0 +1,283 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class EnumerableDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new EnumerableDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.EnumerableDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method(methodData)), + TestFilePath = @"", + TestLineNumber = 8, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method", + TestFilePath = @"", + TestLineNumber = 8, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class EnumerableDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new EnumerableDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method2", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.EnumerableDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method2(methodData)), + TestFilePath = @"", + TestLineNumber = 15, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method2", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method2", + TestFilePath = @"", + TestLineNumber = 15, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class EnumerableDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new EnumerableDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.EnumerableDataSourceDrivenTests.MethodWithBaseReturn()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.EnumerableDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn(TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue):0", + TestClassArguments = [], + TestMethodArguments = [methodData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_WithBaseReturn(methodData)), + TestFilePath = @"", + TestLineNumber = 22, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn(TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue):0", + TestClass = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)], + TestName = "DataSource_WithBaseReturn", + TestFilePath = @"", + TestLineNumber = 22, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.cs b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.cs index 1219c8c5d9..e236a3ac0e 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.cs @@ -12,11 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(3); - - await AssertFileContains(generatedFiles[0], "foreach (var methodDataAccessor in global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod())"); - await AssertFileContains(generatedFiles[0], "TestMethodArguments = [methodData],"); - - await AssertFileContains(generatedFiles[1], "foreach (var methodDataAccessor in global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod())"); - await AssertFileContains(generatedFiles[1], "TestMethodArguments = [methodData],"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt new file mode 100644 index 0000000000..78edbd79c8 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt @@ -0,0 +1,182 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class EnumerableTupleDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new EnumerableTupleDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.TupleMethod()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor; + var methodArgTuples = global::System.TupleExtensions.ToTuple(methodData); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.NamedTupleMethod()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor; + var methodArgTuples = global::System.TupleExtensions.ToTuple(methodData); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS1:{testMethodDataIndex}:TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS1:{testMethodDataIndex}:TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.cs b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.cs index 4e3122134e..4f26f3ea45 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.cs @@ -12,22 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles).HasCount().EqualTo(1); - - await AssertFileContains(generatedFiles[0], "foreach (var methodDataAccessor in global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.TupleMethod())"); - await AssertFileContains(generatedFiles[0], "var methodArgTuples = global::System.TupleExtensions.ToTuple(methodData);"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = methodArgTuples.Item1;"); - await AssertFileContains(generatedFiles[0], "global::System.String methodArg1 = methodArgTuples.Item2;"); - await AssertFileContains(generatedFiles[0], "global::System.Boolean methodArg2 = methodArgTuples.Item3;"); - await AssertFileContains(generatedFiles[0], "TestMethodArguments = [methodArg, methodArg1, methodArg2],"); - await AssertFileContains(generatedFiles[0], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2))"); - - await AssertFileContains(generatedFiles[0], "foreach (var methodDataAccessor in global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.NamedTupleMethod())"); - await AssertFileContains(generatedFiles[0], "var methodArgTuples = global::System.TupleExtensions.ToTuple(methodData);"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = methodArgTuples.Item1;"); - await AssertFileContains(generatedFiles[0], "global::System.String methodArg1 = methodArgTuples.Item2;"); - await AssertFileContains(generatedFiles[0], "global::System.Boolean methodArg2 = methodArgTuples.Item3;"); - await AssertFileContains(generatedFiles[0], "TestMethodArguments = [methodArg, methodArg1, methodArg2],"); - await AssertFileContains(generatedFiles[0], "TestMethodArguments = [methodArg, methodArg1, methodArg2],"); - await AssertFileContains(generatedFiles[0], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2))"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt new file mode 100644 index 0000000000..90b4bd1b13 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt @@ -0,0 +1,212 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class GenericMethodTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new GenericMethodTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.GenericMethodTests); + var methodInfo = typeof(global::TUnit.TestProject.GenericMethodTests) + .GetMethods() + .Where(method => method.IsPublic) + .Where(method => method.Name == "AggregateBy_HasExpectedOutput") + .Where(method => method.GetParameters().Length == 6) + .Where(method => method.GetGenericArguments().Length == 3) + .First(); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.GenericMethodTests.AggregateBy_Numeric_TestData()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor(); + var methodArgTuples = global::System.TupleExtensions.ToTuple, global::System.Func, global::System.Func, global::System.Func, global::System.Collections.Generic.IEqualityComparer, global::System.Collections.Generic.IEnumerable>>(methodData); + global::System.Collections.Generic.IEnumerable methodArg = methodArgTuples.Item1; + global::System.Func methodArg1 = methodArgTuples.Item2; + global::System.Func methodArg2 = methodArgTuples.Item3; + global::System.Func methodArg3 = methodArgTuples.Item4; + global::System.Collections.Generic.IEqualityComparer methodArg4 = methodArgTuples.Item5; + global::System.Collections.Generic.IEnumerable> methodArg5 = methodArgTuples.Item6; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.GenericMethodTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput(System.Collections.Generic.IEnumerable,TKey System.Func(TSource),TAccumulate System.Func(TKey),TAccumulate System.Func(TAccumulate, TSource),System.Collections.Generic.IEqualityComparer,System.Collections.Generic.IEnumerable>):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3, methodArg4, methodArg5], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AggregateBy_HasExpectedOutput(methodArg, methodArg1, methodArg2, methodArg3, methodArg4, methodArg5)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput(System.Collections.Generic.IEnumerable,TKey System.Func(TSource),TAccumulate System.Func(TKey),TAccumulate System.Func(TAccumulate, TSource),System.Collections.Generic.IEqualityComparer,System.Collections.Generic.IEnumerable>):0", + TestClass = typeof(global::TUnit.TestProject.GenericMethodTests), + ReturnType = typeof(global::TUnit.TestProject.GenericMethodTests) + .GetMethods() + .Where(method => method.IsPublic) + .Where(method => method.Name == "AggregateBy_HasExpectedOutput") + .Where(method => method.GetParameters().Length == 6) + .Where(method => method.GetGenericArguments().Length == 3) + .First().ReturnType, + ParameterTypeFullNames = [typeof(global::System.Collections.Generic.IEnumerable), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Collections.Generic.IEqualityComparer), typeof(global::System.Collections.Generic.IEnumerable>)], + TestName = "AggregateBy_HasExpectedOutput", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.GenericMethodTests); + var methodInfo = typeof(global::TUnit.TestProject.GenericMethodTests) + .GetMethods() + .Where(method => method.IsPublic) + .Where(method => method.Name == "AggregateBy_HasExpectedOutput") + .Where(method => method.GetParameters().Length == 6) + .Where(method => method.GetGenericArguments().Length == 3) + .First(); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.GenericMethodTests.AggregateBy_String_TestData()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor(); + var methodArgTuples = global::System.TupleExtensions.ToTuple, global::System.Func, global::System.Func, global::System.Func, global::System.Collections.Generic.IEqualityComparer, global::System.Collections.Generic.IEnumerable>>(methodData); + global::System.Collections.Generic.IEnumerable methodArg = methodArgTuples.Item1; + global::System.Func methodArg1 = methodArgTuples.Item2; + global::System.Func methodArg2 = methodArgTuples.Item3; + global::System.Func methodArg3 = methodArgTuples.Item4; + global::System.Collections.Generic.IEqualityComparer methodArg4 = methodArgTuples.Item5; + global::System.Collections.Generic.IEnumerable> methodArg5 = methodArgTuples.Item6; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.GenericMethodTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS1:{testMethodDataIndex}:TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput(System.Collections.Generic.IEnumerable,TKey System.Func(TSource),TAccumulate System.Func(TKey),TAccumulate System.Func(TAccumulate, TSource),System.Collections.Generic.IEqualityComparer,System.Collections.Generic.IEnumerable>):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3, methodArg4, methodArg5], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AggregateBy_HasExpectedOutput(methodArg, methodArg1, methodArg2, methodArg3, methodArg4, methodArg5)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS1:{testMethodDataIndex}:TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput(System.Collections.Generic.IEnumerable,TKey System.Func(TSource),TAccumulate System.Func(TKey),TAccumulate System.Func(TAccumulate, TSource),System.Collections.Generic.IEqualityComparer,System.Collections.Generic.IEnumerable>):0", + TestClass = typeof(global::TUnit.TestProject.GenericMethodTests), + ReturnType = typeof(global::TUnit.TestProject.GenericMethodTests) + .GetMethods() + .Where(method => method.IsPublic) + .Where(method => method.Name == "AggregateBy_HasExpectedOutput") + .Where(method => method.GetParameters().Length == 6) + .Where(method => method.GetGenericArguments().Length == 3) + .First().ReturnType, + ParameterTypeFullNames = [typeof(global::System.Collections.Generic.IEnumerable), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Collections.Generic.IEqualityComparer), typeof(global::System.Collections.Generic.IEnumerable>)], + TestName = "AggregateBy_HasExpectedOutput", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.cs b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.cs index 630836c1b4..8f224bdaf7 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.cs @@ -12,25 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - - await AssertFileContains(generatedFiles[0], "var methodDataAccessor in global::TUnit.TestProject.GenericMethodTests.AggregateBy_Numeric_TestData()"); - - await AssertFileContains(generatedFiles[0], "var methodArgTuples = global::System.TupleExtensions.ToTuple, global::System.Func, global::System.Func, global::System.Func, global::System.Collections.Generic.IEqualityComparer, global::System.Collections.Generic.IEnumerable>>(methodData);"); - await AssertFileContains(generatedFiles[0], "global::System.Collections.Generic.IEnumerable methodArg = methodArgTuples.Item1;"); - await AssertFileContains(generatedFiles[0], "global::System.Func methodArg1 = methodArgTuples.Item2;"); - await AssertFileContains(generatedFiles[0], "global::System.Func methodArg2 = methodArgTuples.Item3;"); - await AssertFileContains(generatedFiles[0], "global::System.Func methodArg3 = methodArgTuples.Item4;"); - await AssertFileContains(generatedFiles[0], "global::System.Collections.Generic.IEqualityComparer methodArg4 = methodArgTuples.Item5;"); - await AssertFileContains(generatedFiles[0], "global::System.Collections.Generic.IEnumerable> methodArg5 = methodArgTuples.Item6;"); - - await AssertFileContains(generatedFiles[0], "var methodDataAccessor in global::TUnit.TestProject.GenericMethodTests.AggregateBy_String_TestData()"); - - await AssertFileContains(generatedFiles[0], "var methodArgTuples = global::System.TupleExtensions.ToTuple, global::System.Func, global::System.Func, global::System.Func, global::System.Collections.Generic.IEqualityComparer, global::System.Collections.Generic.IEnumerable>>(methodData);"); - await AssertFileContains(generatedFiles[0], "global::System.Collections.Generic.IEnumerable methodArg = methodArgTuples.Item1;"); - await AssertFileContains(generatedFiles[0], "global::System.Func methodArg1 = methodArgTuples.Item2;"); - await AssertFileContains(generatedFiles[0], "global::System.Func methodArg2 = methodArgTuples.Item3;"); - await AssertFileContains(generatedFiles[0], "global::System.Func methodArg3 = methodArgTuples.Item4;"); - await AssertFileContains(generatedFiles[0], "global::System.Collections.Generic.IEqualityComparer methodArg4 = methodArgTuples.Item5;"); - await AssertFileContains(generatedFiles[0], "global::System.Collections.Generic.IEnumerable> methodArg5 = methodArgTuples.Item6;"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt new file mode 100644 index 0000000000..50c5d86997 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt @@ -0,0 +1,785 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1).GetMethod("AfterEach1", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2).GetMethod("AfterEach2", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3).GetMethod("AfterEach3", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalCleanUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUp", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanUp()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalCleanUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanUp(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalCleanUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalCleanUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + new AfterTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1).GetMethod("AfterAll1", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalBase1.AfterAll1(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 5, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + new AfterTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2).GetMethod("AfterAll2", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalBase2.AfterAll2(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 20, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + new AfterTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3).GetMethod("AfterAll3", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalBase3.AfterAll3(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 35, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalCleanUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + new AfterTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUp(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 50, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalCleanUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + new AfterTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUp(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 56, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalCleanUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + new AfterTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 62, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalCleanUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + new AfterTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 68, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.cs b/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.cs index c7b83130a6..775e13c5b1 100644 --- a/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.cs @@ -13,96 +13,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(14); - - await AssertFileContains(generatedFiles[7], - """ - new AfterTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1).GetMethod("AfterAll1", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalBase1.AfterAll1(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 5, - }, - """); - - await AssertFileContains(generatedFiles[8], - """ - new AfterTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2).GetMethod("AfterAll2", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalBase2.AfterAll2(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 20, - }, - """); - - await AssertFileContains(generatedFiles[9], - """ - new AfterTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3).GetMethod("AfterAll3", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalBase3.AfterAll3(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 35, - }, - """); - - await AssertFileContains(generatedFiles[10], - """ - new AfterTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUp(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 50, - }, - """); - - await AssertFileContains(generatedFiles[11], - """ - new AfterTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUp(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 56, - }, - """); - - await AssertFileContains(generatedFiles[12], - """ - new AfterTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUpWithContext(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 62, - }, - """); - - await AssertFileContains(generatedFiles[13], - """ - new AfterTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUpWithContext(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 68, - }, - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt new file mode 100644 index 0000000000..e8bb9712ec --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt @@ -0,0 +1,785 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1).GetMethod("BeforeEach1", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach1()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2).GetMethod("BeforeEach2", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach2()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3).GetMethod("BeforeEach3", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach3()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalSetUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUp", 0, []), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetUp()), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalSetUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUp", 0, [typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetUp(cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalSetUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalSetUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase1 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase1(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + new BeforeTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1).GetMethod("BeforeAll1", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalBase1.BeforeAll1(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 5, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase2 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase2(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + new BeforeTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2).GetMethod("BeforeAll2", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalBase2.BeforeAll2(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 20, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalBase3 : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalBase3(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + new BeforeTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3).GetMethod("BeforeAll3", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalBase3.BeforeAll3(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 35, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalSetUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + new BeforeTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUp(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 50, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalSetUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + new BeforeTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUp(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 56, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalSetUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + new BeforeTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUpWithContext(context)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 62, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_GlobalSetUpTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + new BeforeTestHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUpWithContext(context, cancellationToken)), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 68, + }, + ]; +} +public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) +{ + return + [ + ]; +} +public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) +{ + return + [ + ]; +} +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.cs b/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.cs index df8ac81422..7d39883537 100644 --- a/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.cs @@ -13,96 +13,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(14); - - await AssertFileContains(generatedFiles[7], - """ - new BeforeTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1).GetMethod("BeforeAll1", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalBase1.BeforeAll1(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 5, - }, - """); - - await AssertFileContains(generatedFiles[8], - """ - new BeforeTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2).GetMethod("BeforeAll2", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalBase2.BeforeAll2(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 20, - }, - """); - - await AssertFileContains(generatedFiles[9], - """ - new BeforeTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3).GetMethod("BeforeAll3", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalBase3.BeforeAll3(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 35, - }, - """); - - await AssertFileContains(generatedFiles[10], - """ - new BeforeTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUp(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 50, - }, - """); - - await AssertFileContains(generatedFiles[11], - """ - new BeforeTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUp(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 56, - }, - """); - - await AssertFileContains(generatedFiles[12], - """ - new BeforeTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUpWithContext(context)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 62, - }, - """); - - await AssertFileContains(generatedFiles[13], - """ - new BeforeTestHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), - AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUpWithContext(context, cancellationToken)), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 68, - }, - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalUsings.cs b/TUnit.Core.SourceGenerator.Tests/GlobalUsings.cs index cd28e10b88..8a7d993317 100644 --- a/TUnit.Core.SourceGenerator.Tests/GlobalUsings.cs +++ b/TUnit.Core.SourceGenerator.Tests/GlobalUsings.cs @@ -1,3 +1,3 @@ -global using NUnit.Framework; -global using Assert = TUnit.Assertions.Assert; -global using TestAttribute = NUnit.Framework.TestAttribute; \ No newline at end of file +global using Assert = TUnit.Assertions.Assert; +global using TestAttribute = TUnit.Core.TestAttribute; +global using static TUnit.Core.HookType; \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt new file mode 100644 index 0000000000..7b72b4f27f --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt @@ -0,0 +1,326 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new PropertySetterTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.PropertySetterTests); + var methodInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetMethod("Test", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String propertyArg = "1"; + + global::System.String propertyArg1 = global::TUnit.TestProject.PropertySetterTests.MethodData(); + var propertyInfo2 = testClassType.GetProperty("Property3", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute2 = propertyInfo2.GetCustomAttributes>(true).ElementAt(0); + var propertyArg2 = propertyDataAttribute2.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo2, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo3 = testClassType.GetProperty("Property4", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute3 = propertyInfo3.GetCustomAttributes>(true).ElementAt(0); + var propertyArg3 = propertyDataAttribute3.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo3, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo4 = testClassType.GetProperty("Property5", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute4 = propertyInfo4.GetCustomAttributes>(true).ElementAt(0); + var propertyArg4 = propertyDataAttribute4.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo4, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo5 = testClassType.GetProperty("Property6", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute5 = propertyInfo5.GetCustomAttributes>(true).ElementAt(0); + var propertyArg5 = propertyDataAttribute5.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo5, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo6 = testClassType.GetProperty("StaticProperty", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute6 = propertyInfo6.GetCustomAttributes>(true).ElementAt(0); + var propertyArg6 = propertyDataAttribute6.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo6, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + + global::TUnit.TestProject.PropertySetterTests.StaticProperty = propertyArg6; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.PropertySetterTests() + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + Property5 = propertyArg4, + Property6 = propertyArg5, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.PropertySetterTests.Test:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3, propertyArg4, propertyArg5], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test()), + TestFilePath = @"", + TestLineNumber = 69, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ propertyDataAttribute2, propertyDataAttribute3, propertyDataAttribute4, propertyDataAttribute5, propertyDataAttribute6 ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.PropertySetterTests.Test:0", + TestClass = typeof(global::TUnit.TestProject.PropertySetterTests), + ReturnType = typeof(global::TUnit.TestProject.PropertySetterTests).GetMethod("Test", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Test", + TestFilePath = @"", + TestLineNumber = 69, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Inherited_InheritedPropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new Inherited_InheritedPropertySetterTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.InheritedPropertySetterTests); + var methodInfo = typeof(global::TUnit.TestProject.InheritedPropertySetterTests).GetMethod("Test", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String propertyArg = "1"; + + global::System.String propertyArg1 = global::TUnit.TestProject.InheritedPropertySetterTests.MethodData(); + var propertyInfo2 = testClassType.GetProperty("Property3", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute2 = propertyInfo2.GetCustomAttributes>(true).ElementAt(0); + var propertyArg2 = propertyDataAttribute2.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo2, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo3 = testClassType.GetProperty("Property4", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute3 = propertyInfo3.GetCustomAttributes>(true).ElementAt(0); + var propertyArg3 = propertyDataAttribute3.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo3, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo4 = testClassType.GetProperty("Property5", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute4 = propertyInfo4.GetCustomAttributes>(true).ElementAt(0); + var propertyArg4 = propertyDataAttribute4.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo4, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo5 = testClassType.GetProperty("Property6", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute5 = propertyInfo5.GetCustomAttributes>(true).ElementAt(0); + var propertyArg5 = propertyDataAttribute5.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo5, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo6 = testClassType.GetProperty("StaticProperty", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute6 = propertyInfo6.GetCustomAttributes>(true).ElementAt(0); + var propertyArg6 = propertyDataAttribute6.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo6, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + + global::TUnit.TestProject.InheritedPropertySetterTests.StaticProperty = propertyArg6; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.InheritedPropertySetterTests() + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + Property5 = propertyArg4, + Property6 = propertyArg5, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.InheritedPropertySetterTests.Test:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3, propertyArg4, propertyArg5], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test()), + TestFilePath = @"", + TestLineNumber = 69, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +}, new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ propertyDataAttribute2, propertyDataAttribute3, propertyDataAttribute4, propertyDataAttribute5, propertyDataAttribute6 ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.InheritedPropertySetterTests.Test:0", + TestClass = typeof(global::TUnit.TestProject.InheritedPropertySetterTests), + ReturnType = typeof(global::TUnit.TestProject.InheritedPropertySetterTests).GetMethod("Test", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Test", + TestFilePath = @"", + TestLineNumber = 69, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt new file mode 100644 index 0000000000..467866eea1 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt @@ -0,0 +1,365 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new InheritedTestsFromDifferentProjectTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); + var methodInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("Test", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test()), + TestFilePath = @"", + TestLineNumber = 6, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test:0", + TestClass = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + ReturnType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("Test", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Test", + TestFilePath = @"", + TestLineNumber = 6, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new InheritedTestsFromDifferentProjectTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); + var methodInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("GenericMethodDataSource", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = global::TUnit.TestProject.TestData.Foo(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.InheritedTestsFromDifferentProjectTests.GenericMethodDataSource(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.GenericMethodDataSource(methodArg)), + TestFilePath = @"", + TestLineNumber = 11, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("Foo") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.InheritedTestsFromDifferentProjectTests.GenericMethodDataSource(System.String):0", + TestClass = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + ReturnType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("GenericMethodDataSource", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "GenericMethodDataSource", + TestFilePath = @"", + TestLineNumber = 11, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new InheritedTestsFromDifferentProjectTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); + var methodInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("NonGenericMethodDataSource", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = global::TUnit.TestProject.TestData.Foo(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.NonGenericMethodDataSource(methodArg)), + TestFilePath = @"", + TestLineNumber = 17, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.TestData), "Foo") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource(System.String):0", + TestClass = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + ReturnType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("NonGenericMethodDataSource", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "NonGenericMethodDataSource", + TestFilePath = @"", + TestLineNumber = 17, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Inherited_InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new Inherited_InheritedTestsFromDifferentProjectTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); + var methodInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("BaseTest", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTest:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.BaseTest()), + TestFilePath = @"", + TestLineNumber = 7, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTest:0", + TestClass = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + ReturnType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("BaseTest", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "BaseTest", + TestFilePath = @"", + TestLineNumber = 7, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt new file mode 100644 index 0000000000..9f65e00f06 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt @@ -0,0 +1,5142 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MatrixTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ..Tests4(sessionId), + ..Tests5(sessionId), + ..Tests6(sessionId), + ..Tests7(sessionId), + ..Tests8(sessionId), + ..Tests9(sessionId), + ..Tests10(sessionId), + ..Tests11(sessionId), + ..Tests12(sessionId), + ..Tests13(sessionId), + ..Tests14(sessionId), + ..Tests15(sessionId), + ..Tests16(sessionId), + ..Tests17(sessionId), + ..Tests18(sessionId), + ..Tests19(sessionId), + ..Tests20(sessionId), + ..Tests21(sessionId), + ..Tests22(sessionId), + ..Tests23(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "A"; + global::System.Int32 methodArg1 = 1; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS0:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS0:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "A"; + global::System.Int32 methodArg1 = 1; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS1:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS1:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "A"; + global::System.Int32 methodArg1 = 2; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS2:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS2:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "A"; + global::System.Int32 methodArg1 = 2; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS3:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS3:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests4(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "A"; + global::System.Int32 methodArg1 = 3; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS4:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS4:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests5(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "A"; + global::System.Int32 methodArg1 = 3; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS5:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS5:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests6(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "B"; + global::System.Int32 methodArg1 = 1; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS6:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS6:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests7(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "B"; + global::System.Int32 methodArg1 = 1; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS7:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS7:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests8(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "B"; + global::System.Int32 methodArg1 = 2; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS8:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS8:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests9(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "B"; + global::System.Int32 methodArg1 = 2; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS9:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS9:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests10(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "B"; + global::System.Int32 methodArg1 = 3; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS10:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS10:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests11(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "B"; + global::System.Int32 methodArg1 = 3; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS11:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS11:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests12(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "C"; + global::System.Int32 methodArg1 = 1; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS12:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS12:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests13(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "C"; + global::System.Int32 methodArg1 = 1; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS13:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS13:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests14(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "C"; + global::System.Int32 methodArg1 = 2; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS14:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS14:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests15(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "C"; + global::System.Int32 methodArg1 = 2; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS15:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS15:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests16(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "C"; + global::System.Int32 methodArg1 = 3; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS16:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS16:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests17(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "C"; + global::System.Int32 methodArg1 = 3; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS17:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS17:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests18(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "D"; + global::System.Int32 methodArg1 = 1; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS18:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS18:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests19(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "D"; + global::System.Int32 methodArg1 = 1; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS19:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS19:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests20(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "D"; + global::System.Int32 methodArg1 = 2; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS20:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS20:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests21(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "D"; + global::System.Int32 methodArg1 = 2; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS21:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS21:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests22(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "D"; + global::System.Int32 methodArg1 = 3; + global::System.Boolean methodArg2 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS22:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS22:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests23(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "D"; + global::System.Int32 methodArg1 = 3; + global::System.Boolean methodArg2 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS23:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_One(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS23:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_One", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MatrixTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ..Tests4(sessionId), + ..Tests5(sessionId), + ..Tests6(sessionId), + ..Tests7(sessionId), + ..Tests8(sessionId), + ..Tests9(sessionId), + ..Tests10(sessionId), + ..Tests11(sessionId), + ..Tests12(sessionId), + ..Tests13(sessionId), + ..Tests14(sessionId), + ..Tests15(sessionId), + ..Tests16(sessionId), + ..Tests17(sessionId), + ..Tests18(sessionId), + ..Tests19(sessionId), + ..Tests20(sessionId), + ..Tests21(sessionId), + ..Tests22(sessionId), + ..Tests23(sessionId), + ..Tests24(sessionId), + ..Tests25(sessionId), + ..Tests26(sessionId), + ..Tests27(sessionId), + ..Tests28(sessionId), + ..Tests29(sessionId), + ..Tests30(sessionId), + ..Tests31(sessionId), + ..Tests32(sessionId), + ..Tests33(sessionId), + ..Tests34(sessionId), + ..Tests35(sessionId), + ..Tests36(sessionId), + ..Tests37(sessionId), + ..Tests38(sessionId), + ..Tests39(sessionId), + ..Tests40(sessionId), + ..Tests41(sessionId), + ..Tests42(sessionId), + ..Tests43(sessionId), + ..Tests44(sessionId), + ..Tests45(sessionId), + ..Tests46(sessionId), + ..Tests47(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS0:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS0:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS1:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS1:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS2:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS2:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS3:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS3:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests4(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS4:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS4:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests5(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS5:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS5:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests6(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS6:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS6:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests7(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS7:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS7:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests8(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS8:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS8:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests9(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS9:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS9:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests10(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS10:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS10:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests11(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS11:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS11:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests12(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS12:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS12:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests13(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS13:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS13:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests14(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS14:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS14:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests15(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS15:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS15:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests16(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS16:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS16:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests17(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS17:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS17:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests18(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS18:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS18:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests19(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS19:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS19:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests20(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS20:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS20:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests21(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS21:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS21:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests22(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS22:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS22:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests23(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS23:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS23:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests24(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS24:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS24:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests25(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS25:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS25:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests26(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS26:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS26:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests27(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS27:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS27:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests28(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS28:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS28:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests29(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS29:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS29:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests30(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS30:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS30:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests31(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 1; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS31:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS31:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests32(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS32:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS32:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests33(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS33:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS33:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests34(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS34:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS34:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests35(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS35:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS35:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests36(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS36:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS36:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests37(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS37:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS37:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests38(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS38:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS38:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests39(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 2; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS39:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS39:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests40(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS40:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS40:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests41(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 1; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS41:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS41:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests42(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS42:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS42:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests43(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 2; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS43:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS43:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests44(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS44:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS44:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests45(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 3; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS45:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS45:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests46(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = true; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS46:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS46:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests47(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::System.Int32 methodArg1 = 3; + global::System.Int32 methodArg2 = 4; + global::System.Boolean methodArg3 = false; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS47:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2, methodArg3], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Two(methodArg, methodArg1, methodArg2, methodArg3)), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS47:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], + TestName = "MatrixTest_Two", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MatrixTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::TUnit.TestProject.TestEnum methodArg1 = (global::TUnit.TestProject.TestEnum)(-1); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS0:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Enum(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS0:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)], + TestName = "MatrixTest_Enum", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + global::TUnit.TestProject.TestEnum methodArg1 = global::TUnit.TestProject.TestEnum.One; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS1:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Enum(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS1:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)], + TestName = "MatrixTest_Enum", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::TUnit.TestProject.TestEnum methodArg1 = (global::TUnit.TestProject.TestEnum)(-1); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS2:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Enum(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS2:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)], + TestName = "MatrixTest_Enum", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MatrixTests); + var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 2; + global::TUnit.TestProject.TestEnum methodArg1 = global::TUnit.TestProject.TestEnum.One; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MatrixTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TL-ARGS3:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest_Enum(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TL-ARGS3:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", + TestClass = typeof(global::TUnit.TestProject.MatrixTests), + ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)], + TestName = "MatrixTest_Enum", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/MatrixTests.cs b/TUnit.Core.SourceGenerator.Tests/MatrixTests.cs index 926661dd70..9faec8a0b4 100644 --- a/TUnit.Core.SourceGenerator.Tests/MatrixTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/MatrixTests.cs @@ -22,25 +22,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(3); - - AssertTestOne(generatedFiles); - AssertTestTwo(generatedFiles); - await AssertTestThree(generatedFiles); }); - - private void AssertTestOne(string[] generatedFiles) - { - } - - private void AssertTestTwo(string[] generatedFiles) - { - } - - private async Task AssertTestThree(string[] generatedFiles) - { - await AssertFileContains(generatedFiles[2], "global::TUnit.TestProject.TestEnum methodArg1 = (global::TUnit.TestProject.TestEnum)(-1);"); - await AssertFileContains(generatedFiles[2], "global::TUnit.TestProject.TestEnum methodArg1 = global::TUnit.TestProject.TestEnum.One;"); - await AssertFileContains(generatedFiles[2], "global::TUnit.TestProject.TestEnum methodArg1 = (global::TUnit.TestProject.TestEnum)(-1);"); - await AssertFileContains(generatedFiles[2], "global::TUnit.TestProject.TestEnum methodArg1 = global::TUnit.TestProject.TestEnum.One;"); - } } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt new file mode 100644 index 0000000000..63f5554153 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt @@ -0,0 +1,947 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MethodDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method(methodArg)), + TestFilePath = @"", + TestLineNumber = 11, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method", + TestFilePath = @"", + TestLineNumber = 11, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MethodDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method2(methodArg)), + TestFilePath = @"", + TestLineNumber = 18, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method2", + TestFilePath = @"", + TestLineNumber = 18, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MethodDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", 0, [typeof(global::System.Action)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Action methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction()(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction(void System.Action()):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method_WithAction(methodArg)), + TestFilePath = @"", + TestLineNumber = 25, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction(void System.Action()):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", 0, [typeof(global::System.Action)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Action)], + TestName = "DataSource_Method_WithAction", + TestFilePath = @"", + TestLineNumber = 25, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MethodDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(5); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method3(methodArg)), + TestFilePath = @"", + TestLineNumber = 32, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = [5], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { 5 }, +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method3", + TestFilePath = @"", + TestLineNumber = 32, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(5 ); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method3(methodArg)), + TestFilePath = @"", + TestLineNumber = 32, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = [5], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { 5 }, +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method3", + TestFilePath = @"", + TestLineNumber = 32, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MethodDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod("Hello World!", 5, true); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method4(methodArg)), + TestFilePath = @"", + TestLineNumber = 41, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = ["Hello World!", 5, true], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { "Hello World!", 6, true }, +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = ["Hello World!", 7, true], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { "Hello World!", 8, true }, +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method4", + TestFilePath = @"", + TestLineNumber = 41, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod("Hello World!", 6, true ); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method4(methodArg)), + TestFilePath = @"", + TestLineNumber = 41, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = ["Hello World!", 5, true], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { "Hello World!", 6, true }, +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = ["Hello World!", 7, true], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { "Hello World!", 8, true }, +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method4", + TestFilePath = @"", + TestLineNumber = 41, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod("Hello World!", 7, true); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method4(methodArg)), + TestFilePath = @"", + TestLineNumber = 41, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = ["Hello World!", 5, true], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { "Hello World!", 6, true }, +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = ["Hello World!", 7, true], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { "Hello World!", 8, true }, +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method4", + TestFilePath = @"", + TestLineNumber = 41, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod("Hello World!", 8, true ); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS3:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_Method4(methodArg)), + TestFilePath = @"", + TestLineNumber = 41, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = ["Hello World!", 5, true], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { "Hello World!", 6, true }, +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = ["Hello World!", 7, true], +}, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") +{ + Arguments = new global::System.Object[] { "Hello World!", 8, true }, +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS3:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "DataSource_Method4", + TestFilePath = @"", + TestLineNumber = 41, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MethodDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn()(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn(TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_WithBaseReturn(methodArg)), + TestFilePath = @"", + TestLineNumber = 52, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn(TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)]).ReturnType, + ParameterTypeFullNames = [typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)], + TestName = "DataSource_WithBaseReturn", + TestFilePath = @"", + TestLineNumber = 52, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MethodDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", 0, [typeof(global::System.String[])]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest(System.String[]):0", + TestClassArguments = [], + TestMethodArguments = [methodData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.EnumerableFuncArrayTest(methodData)), + TestFilePath = @"", + TestLineNumber = 58, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest(System.String[]):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", 0, [typeof(global::System.String[])]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String[])], + TestName = "EnumerableFuncArrayTest", + TestFilePath = @"", + TestLineNumber = 58, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.cs b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.cs index 6949e972d5..8359ef4af7 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.cs @@ -12,25 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(7); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod();"); - await AssertFileContains(generatedFiles[0], "classInstance.DataSource_Method(methodArg)"); - - await AssertFileContains(generatedFiles[1], "global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod();"); - await AssertFileContains(generatedFiles[1], "classInstance.DataSource_Method2(methodArg)"); - - await AssertFileContains(generatedFiles[2], "global::System.Action methodArg = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction()();"); - await AssertFileContains(generatedFiles[2], "classInstance.DataSource_Method_WithAction(methodArg)"); - - await AssertFileContains(generatedFiles[3], "global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(5)"); - await AssertFileContains(generatedFiles[3], "global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(5)"); - - await AssertFileContains(generatedFiles[4], "global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(\"Hello World!\", 5, true)"); - await AssertFileContains(generatedFiles[4], "global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(\"Hello World!\", 6, true)"); - await AssertFileContains(generatedFiles[4], "global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(\"Hello World!\", 7, true)"); - await AssertFileContains(generatedFiles[4], "global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(\"Hello World!\", 8, true)"); - - await AssertFileContains(generatedFiles[6], "foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData())"); - await AssertFileContains(generatedFiles[6], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.EnumerableFuncArrayTest(methodData)),"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt new file mode 100644 index 0000000000..7a3bf6c9d7 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt @@ -0,0 +1,548 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MethodDataSourceDrivenWithCancellationTokenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ..Tests4(sessionId), + ..Tests5(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.T(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MyTest(methodArg, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("T") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("FuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") +{ + +} ], + ClassAttributes = [ new global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "MyTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.FuncT()(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MyTest(methodArg, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("T") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("FuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") +{ + +} ], + ClassAttributes = [ new global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "MyTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableT()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS2:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [], + TestMethodArguments = [methodData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MyTest(methodData, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("T") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("FuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") +{ + +} ], + ClassAttributes = [ new global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS2:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "MyTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableFuncT()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS3:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [], + TestMethodArguments = [methodData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MyTest(methodData, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("T") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("FuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") +{ + +} ], + ClassAttributes = [ new global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS3:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "MyTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests4(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayT()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS4:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [], + TestMethodArguments = [methodData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MyTest(methodData, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("T") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("FuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") +{ + +} ], + ClassAttributes = [ new global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS4:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "MyTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests5(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayFuncT()) + { + testMethodDataIndex++; + + var methodData = methodDataAccessor(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS5:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [], + TestMethodArguments = [methodData], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MyTest(methodData, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 10, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("T") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("FuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") +{ + +} ], + ClassAttributes = [ new global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS5:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "MyTest", + TestFilePath = @"", + TestLineNumber = 10, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.cs b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.cs index fa1ffa63c1..164c47dc6a 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.cs @@ -12,27 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.T();"); - await AssertFileContains(generatedFiles[0], "classInstance.MyTest(methodArg, cancellationToken)"); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.FuncT()();"); - await AssertFileContains(generatedFiles[0], "classInstance.MyTest(methodArg, cancellationToken)"); - - await AssertFileContains(generatedFiles[0], "foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableT())"); - await AssertFileContains(generatedFiles[0], "var methodData = methodDataAccessor;"); - await AssertFileContains(generatedFiles[0], "classInstance.MyTest(methodData, cancellationToken)"); - - await AssertFileContains(generatedFiles[0], "foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableFuncT())"); - await AssertFileContains(generatedFiles[0], "var methodData = methodDataAccessor();"); - await AssertFileContains(generatedFiles[0], "classInstance.MyTest(methodData, cancellationToken)"); - - await AssertFileContains(generatedFiles[0], "foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayT())"); - await AssertFileContains(generatedFiles[0], "var methodData = methodDataAccessor;"); - await AssertFileContains(generatedFiles[0], "classInstance.MyTest(methodData, cancellationToken)"); - - await AssertFileContains(generatedFiles[0], "foreach (var methodDataAccessor in global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayFuncT())"); - await AssertFileContains(generatedFiles[0], "var methodData = methodDataAccessor();"); - await AssertFileContains(generatedFiles[0], "classInstance.MyTest(methodData, cancellationToken)"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt new file mode 100644 index 0000000000..9fccbd26a0 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt @@ -0,0 +1,227 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MultipleClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MultipleClassDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetMethod("Test1", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetCustomAttributes>(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1 classArg = classArgGeneratedData.Item1; + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2 classArg1 = classArgGeneratedData.Item2; + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3 classArg2 = classArgGeneratedData.Item3; + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4 classArg3 = classArgGeneratedData.Item4; + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5 classArg4 = classArgGeneratedData.Item5; + + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(classArg, classArg1, classArg2, classArg3, classArg4) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.MultipleClassDataSourceDrivenTests(TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5).Test1:0", + TestClassArguments = [classArg, classArg1, classArg2, classArg3, classArg4], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test1()), + TestFilePath = @"", + TestLineNumber = 14, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = [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], +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.MultipleClassDataSourceDrivenTests(TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5).Test1:0", + TestClass = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetMethod("Test1", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Test1", + TestFilePath = @"", + TestLineNumber = 14, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class MultipleClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new MultipleClassDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetMethod("Test2", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgDataGeneratorMetadata = new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Parameters, + TestClassType = testClassType, + ParameterInfos = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructors().First().GetParameters(), + PropertyInfo = null, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}; + var classDataAttribute = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetCustomAttributes>(true).ElementAt(0); + + var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); + + foreach (var classArgGeneratedDataAccessor in classArgGeneratedDataArray) + { + classDataIndex++; + var classArgGeneratedData = classArgGeneratedDataAccessor(); + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1 classArg = classArgGeneratedData.Item1; + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2 classArg1 = classArgGeneratedData.Item2; + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3 classArg2 = classArgGeneratedData.Item3; + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4 classArg3 = classArgGeneratedData.Item4; + global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5 classArg4 = classArgGeneratedData.Item5; + + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(classArg, classArg1, classArg2, classArg3, classArg4) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.MultipleClassDataSourceDrivenTests(TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5).Test2:0", + TestClassArguments = [classArg, classArg1, classArg2, classArg3, classArg4], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test2()), + TestFilePath = @"", + TestLineNumber = 20, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = [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], +} ], + AssemblyAttributes = [ ], + DataAttributes = [ classDataAttribute ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.MultipleClassDataSourceDrivenTests(TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5).Test2:0", + TestClass = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetMethod("Test2", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Test2", + TestFilePath = @"", + TestLineNumber = 20, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.cs b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.cs index 91306cb3f2..51ff96f593 100644 --- a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.cs @@ -12,16 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(2); - - await AssertFileContains(generatedFiles[0], - "global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1 classArg = classArgGeneratedData.Item1;"); - await AssertFileContains(generatedFiles[0], - "global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2 classArg1 = classArgGeneratedData.Item2;"); - await AssertFileContains(generatedFiles[0], - "global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3 classArg2 = classArgGeneratedData.Item3;"); - await AssertFileContains(generatedFiles[0], - "global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4 classArg3 = classArgGeneratedData.Item4;"); - await AssertFileContains(generatedFiles[0], - "global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5 classArg4 = classArgGeneratedData.Item5;"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt new file mode 100644 index 0000000000..f8e7b36f44 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt @@ -0,0 +1,92 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NameOfArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NameOfArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NameOfArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NameOfArgumentTests).GetMethod("TestName", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "TestName"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NameOfArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NameOfArgumentTests.TestName(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.TestName(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("TestName") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NameOfArgumentTests.TestName(System.String):0", + TestClass = typeof(global::TUnit.TestProject.NameOfArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NameOfArgumentTests).GetMethod("TestName", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "TestName", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.cs b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.cs index 7644f4b621..cf916775d8 100644 --- a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.cs @@ -12,7 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - - await AssertFileContains(generatedFiles[0], "global::System.String methodArg = \"TestName\";"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt new file mode 100644 index 0000000000..16d5620d4e --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt @@ -0,0 +1,337 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NullableByteArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", 0, [typeof(global::System.Byte?)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Byte? methodArg = (global::System.Byte)1; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NullableByteArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NullableByteArgumentTests.Test(System.Byte?):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute((global::System.Byte)1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NullableByteArgumentTests.Test(System.Byte?):0", + TestClass = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", 0, [typeof(global::System.Byte?)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Byte?)], + TestName = "Test", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", 0, [typeof(global::System.Byte?)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Byte? methodArg = null; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NullableByteArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.NullableByteArgumentTests.Test(System.Byte?):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute((global::System.Byte)1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.NullableByteArgumentTests.Test(System.Byte?):0", + TestClass = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", 0, [typeof(global::System.Byte?)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Byte?)], + TestName = "Test", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NullableByteArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Byte methodArg = (global::System.Byte)1; + global::System.Byte? methodArg1 = (global::System.Byte)1; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NullableByteArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NullableByteArgumentTests.Test2(System.Byte,System.Byte?):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test2(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 12, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute((global::System.Byte)1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute((global::System.Byte)1) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NullableByteArgumentTests.Test2(System.Byte,System.Byte?):0", + TestClass = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Byte), typeof(global::System.Byte?)], + TestName = "Test2", + TestFilePath = @"", + TestLineNumber = 12, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Byte methodArg = (global::System.Byte)1; + global::System.Byte? methodArg1 = null; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NullableByteArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.NullableByteArgumentTests.Test2(System.Byte,System.Byte?):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test2(methodArg, methodArg1)), + TestFilePath = @"", + TestLineNumber = 12, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute((global::System.Byte)1) +{ + +}, new global::TUnit.Core.ArgumentsAttribute((global::System.Byte)1) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.NullableByteArgumentTests.Test2(System.Byte,System.Byte?):0", + TestClass = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Byte), typeof(global::System.Byte?)], + TestName = "Test2", + TestFilePath = @"", + TestLineNumber = 12, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.cs b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.cs index b2b9761753..11f488d2db 100644 --- a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.cs @@ -12,27 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(2); - - await AssertFileContains(generatedFiles[0], - """ - global::System.Byte? methodArg = (global::System.Byte)1; - """); - - await AssertFileContains(generatedFiles[0], - """ - global::System.Byte? methodArg = null; - """); - - await AssertFileContains(generatedFiles[1], - """ - global::System.Byte methodArg = (global::System.Byte)1; - global::System.Byte? methodArg1 = (global::System.Byte)1; - """); - - await AssertFileContains(generatedFiles[1], - """ - global::System.Byte methodArg = (global::System.Byte)1; - global::System.Byte? methodArg1 = null; - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt new file mode 100644 index 0000000000..2484cbff19 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt @@ -0,0 +1,547 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Int(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Int(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Int(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "Int", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", 0, [typeof(global::System.Double)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Double methodArg = 1.1; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Double(System.Double):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Double(methodArg)), + TestFilePath = @"", + TestLineNumber = 12, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1.1) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Double(System.Double):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", 0, [typeof(global::System.Double)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Double)], + TestName = "Double", + TestFilePath = @"", + TestLineNumber = 12, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", 0, [typeof(global::System.Single)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Single methodArg = 1.1f; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Float(System.Single):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Float(methodArg)), + TestFilePath = @"", + TestLineNumber = 19, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1.1f) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Float(System.Single):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", 0, [typeof(global::System.Single)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Single)], + TestName = "Float", + TestFilePath = @"", + TestLineNumber = 19, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", 0, [typeof(global::System.Int64)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int64 methodArg = 1L; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Long(System.Int64):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Long(methodArg)), + TestFilePath = @"", + TestLineNumber = 26, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1L) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Long(System.Int64):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", 0, [typeof(global::System.Int64)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int64)], + TestName = "Long", + TestFilePath = @"", + TestLineNumber = 26, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.UInt64 methodArg = 1UL; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.ULong(System.UInt64):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.ULong(methodArg)), + TestFilePath = @"", + TestLineNumber = 33, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1UL) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.ULong(System.UInt64):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.UInt64)], + TestName = "ULong", + TestFilePath = @"", + TestLineNumber = 33, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.UInt32 methodArg = 1U; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.UInt(System.UInt32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.UInt(methodArg)), + TestFilePath = @"", + TestLineNumber = 40, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1U) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.UInt(System.UInt32):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.UInt32)], + TestName = "UInt", + TestFilePath = @"", + TestLineNumber = 40, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt new file mode 100644 index 0000000000..2484cbff19 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt @@ -0,0 +1,547 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", 0, [typeof(global::System.Int32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int32 methodArg = 1; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Int(System.Int32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Int(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Int(System.Int32):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", 0, [typeof(global::System.Int32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32)], + TestName = "Int", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", 0, [typeof(global::System.Double)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Double methodArg = 1.1; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Double(System.Double):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Double(methodArg)), + TestFilePath = @"", + TestLineNumber = 12, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1.1) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Double(System.Double):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", 0, [typeof(global::System.Double)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Double)], + TestName = "Double", + TestFilePath = @"", + TestLineNumber = 12, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", 0, [typeof(global::System.Single)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Single methodArg = 1.1f; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Float(System.Single):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Float(methodArg)), + TestFilePath = @"", + TestLineNumber = 19, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1.1f) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Float(System.Single):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", 0, [typeof(global::System.Single)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Single)], + TestName = "Float", + TestFilePath = @"", + TestLineNumber = 19, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", 0, [typeof(global::System.Int64)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.Int64 methodArg = 1L; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Long(System.Int64):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Long(methodArg)), + TestFilePath = @"", + TestLineNumber = 26, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1L) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Long(System.Int64):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", 0, [typeof(global::System.Int64)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int64)], + TestName = "Long", + TestFilePath = @"", + TestLineNumber = 26, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.UInt64 methodArg = 1UL; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.ULong(System.UInt64):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.ULong(methodArg)), + TestFilePath = @"", + TestLineNumber = 33, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1UL) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.ULong(System.UInt64):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.UInt64)], + TestName = "ULong", + TestFilePath = @"", + TestLineNumber = 33, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new NumberArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.UInt32 methodArg = 1U; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.NumberArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.UInt(System.UInt32):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.UInt(methodArg)), + TestFilePath = @"", + TestLineNumber = 40, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1U) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.UInt(System.UInt32):0", + TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.UInt32)], + TestName = "UInt", + TestFilePath = @"", + TestLineNumber = 40, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.cs b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.cs index 4e61d56389..1fe78b4e8e 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.cs @@ -1,4 +1,7 @@ +using System.Globalization; using TUnit.Assertions.Extensions; +using TUnit.Core.Executors; +using TUnit.Core.Interfaces; using TUnit.Core.SourceGenerator.CodeGenerators; namespace TUnit.Core.SourceGenerator.Tests; @@ -12,16 +15,48 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(6); - - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = 1;"); - await AssertFileContains(generatedFiles[1], "global::System.Double methodArg = 1.1;"); - await AssertFileContains(generatedFiles[2], "global::System.Single methodArg = 1.1f;"); - await AssertFileContains(generatedFiles[3], "global::System.Int64 methodArg = 1L;"); - await AssertFileContains(generatedFiles[4], "global::System.UInt64 methodArg = 1UL;"); - await AssertFileContains(generatedFiles[5], "global::System.UInt32 methodArg = 1U;"); }); [Test] - [SetCulture("de-DE")] + [TestExecutor] public Task TestDE() => Test(); + + public class SetCulture : GenericAbstractExecutor + { + protected override async Task ExecuteAsync(Func action) + { + var tcs = new TaskCompletionSource(); + + var thread = new Thread(() => + { + try + { + action().GetAwaiter().GetResult(); + tcs.SetResult(null); + } + catch (Exception e) + { + tcs.SetException(e); + } + }); + + var cultureInfoByIetfLanguageTag = CultureInfo.GetCultureInfoByIetfLanguageTag("de-DE"); + thread.CurrentCulture = cultureInfoByIetfLanguageTag; + thread.CurrentUICulture = cultureInfoByIetfLanguageTag; + thread.Start(); + + await tcs.Task; + } + + protected override void ExecuteSync(Action action) + { + var thread = new Thread(() => action()); + + var cultureInfoByIetfLanguageTag = CultureInfo.GetCultureInfoByIetfLanguageTag("de-DE"); + thread.CurrentCulture = cultureInfoByIetfLanguageTag; + thread.CurrentUICulture = cultureInfoByIetfLanguageTag; + thread.Start(); + thread.Join(); + } + } } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt new file mode 100644 index 0000000000..991b80ae32 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt @@ -0,0 +1,535 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new PriorityFilteringTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); + var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_1", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.PriorityFilteringTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.High_1:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.High_1()), + TestFilePath = @"", + TestLineNumber = 12, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.High_1:0", + TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), + ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_1", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "High_1", + TestFilePath = @"", + TestLineNumber = 12, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new PriorityFilteringTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); + var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_2", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.PriorityFilteringTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.High_2:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.High_2()), + TestFilePath = @"", + TestLineNumber = 18, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.High_2:0", + TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), + ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_2", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "High_2", + TestFilePath = @"", + TestLineNumber = 18, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new PriorityFilteringTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); + var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_3", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.PriorityFilteringTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.High_3:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.High_3()), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.High_3:0", + TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), + ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_3", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "High_3", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new PriorityFilteringTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); + var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Medium_1", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.PriorityFilteringTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.Medium_1:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Medium_1()), + TestFilePath = @"", + TestLineNumber = 30, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.Medium_1:0", + TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), + ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Medium_1", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Medium_1", + TestFilePath = @"", + TestLineNumber = 30, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new PriorityFilteringTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); + var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Medium_2", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.PriorityFilteringTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.Medium_2:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Medium_2()), + TestFilePath = @"", + TestLineNumber = 36, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.Medium_2:0", + TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), + ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Medium_2", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Medium_2", + TestFilePath = @"", + TestLineNumber = 36, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new PriorityFilteringTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); + var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Low_1", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.PriorityFilteringTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.Low_1:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Low_1()), + TestFilePath = @"", + TestLineNumber = 42, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Low) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.PriorityFilteringTests.Low_1:0", + TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), + ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Low_1", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Low_1", + TestFilePath = @"", + TestLineNumber = 42, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt new file mode 100644 index 0000000000..46ba9ac154 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt @@ -0,0 +1,162 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new PropertySetterTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.PropertySetterTests); + var methodInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetMethod("Test", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.String propertyArg = "1"; + + global::System.String propertyArg1 = global::TUnit.TestProject.PropertySetterTests.MethodData(); + var propertyInfo2 = testClassType.GetProperty("Property3", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute2 = propertyInfo2.GetCustomAttributes>(true).ElementAt(0); + var propertyArg2 = propertyDataAttribute2.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo2, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo3 = testClassType.GetProperty("Property4", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute3 = propertyInfo3.GetCustomAttributes>(true).ElementAt(0); + var propertyArg3 = propertyDataAttribute3.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo3, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo4 = testClassType.GetProperty("Property5", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute4 = propertyInfo4.GetCustomAttributes>(true).ElementAt(0); + var propertyArg4 = propertyDataAttribute4.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo4, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo5 = testClassType.GetProperty("Property6", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute5 = propertyInfo5.GetCustomAttributes>(true).ElementAt(0); + var propertyArg5 = propertyDataAttribute5.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo5, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + var propertyInfo6 = testClassType.GetProperty("StaticProperty", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var propertyDataAttribute6 = propertyInfo6.GetCustomAttributes>(true).ElementAt(0); + var propertyArg6 = propertyDataAttribute6.GenerateDataSources(new DataGeneratorMetadata +{ + Type = TUnit.Core.Enums.DataGeneratorType.Property, + TestClassType = testClassType, + ParameterInfos = null, + PropertyInfo = propertyInfo6, + TestBuilderContext = testBuilderContextAccessor, + TestSessionId = sessionId, +}).ElementAtOrDefault(0)(); + + + global::TUnit.TestProject.PropertySetterTests.StaticProperty = propertyArg6; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.PropertySetterTests() + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + Property5 = propertyArg4, + Property6 = propertyArg5, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.PropertySetterTests.Test:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3, propertyArg4, propertyArg5], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test()), + TestFilePath = @"", + TestLineNumber = 69, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ propertyDataAttribute2, propertyDataAttribute3, propertyDataAttribute4, propertyDataAttribute5, propertyDataAttribute6 ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.PropertySetterTests.Test:0", + TestClass = typeof(global::TUnit.TestProject.PropertySetterTests), + ReturnType = typeof(global::TUnit.TestProject.PropertySetterTests).GetMethod("Test", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Test", + TestFilePath = @"", + TestLineNumber = 69, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.cs b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.cs index bb4778440e..fdf7f8574f 100644 --- a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.cs @@ -13,39 +13,6 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, { await Assert.That(generatedFiles.Length).IsEqualTo(1); - await AssertFileContains(generatedFiles[0], "global::System.String propertyArg = \"1\";"); - - await AssertFileContains(generatedFiles[0], "global::System.String propertyArg1 = global::TUnit.TestProject.PropertySetterTests.MethodData();"); - - await AssertFileContains(generatedFiles[0], "var propertyInfo2 = testClassType.GetProperty(\"Property3\", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);"); - await AssertFileContains(generatedFiles[0], "var propertyDataAttribute2 = propertyInfo2.GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[0], "var propertyArg2 = propertyDataAttribute2.GenerateDataSources(new DataGeneratorMetadata\n{\n Type = TUnit.Core.Enums.DataGeneratorType.Property,\n TestClassType = testClassType,\n ParameterInfos = null,\n PropertyInfo = propertyInfo2,\n TestBuilderContext = testBuilderContextAccessor,\n TestSessionId = sessionId,\n}).ElementAtOrDefault(0)();"); - - await AssertFileContains(generatedFiles[0], "var propertyInfo3 = testClassType.GetProperty(\"Property4\", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);"); - await AssertFileContains(generatedFiles[0], "var propertyDataAttribute3 = propertyInfo3.GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[0], "var propertyArg3 = propertyDataAttribute3.GenerateDataSources(new DataGeneratorMetadata\n{\n Type = TUnit.Core.Enums.DataGeneratorType.Property,\n TestClassType = testClassType,\n ParameterInfos = null,\n PropertyInfo = propertyInfo3,\n TestBuilderContext = testBuilderContextAccessor,\n TestSessionId = sessionId,\n}).ElementAtOrDefault(0)();"); - - await AssertFileContains(generatedFiles[0], "var propertyInfo4 = testClassType.GetProperty(\"Property5\", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);"); - await AssertFileContains(generatedFiles[0], "var propertyDataAttribute4 = propertyInfo4.GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[0], "var propertyArg4 = propertyDataAttribute4.GenerateDataSources(new DataGeneratorMetadata\n{\n Type = TUnit.Core.Enums.DataGeneratorType.Property,\n TestClassType = testClassType,\n ParameterInfos = null,\n PropertyInfo = propertyInfo4,\n TestBuilderContext = testBuilderContextAccessor,\n TestSessionId = sessionId,\n}).ElementAtOrDefault(0)();"); - - await AssertFileContains(generatedFiles[0], "var propertyInfo5 = testClassType.GetProperty(\"Property6\", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);"); - await AssertFileContains(generatedFiles[0], "var propertyDataAttribute5 = propertyInfo5.GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[0], "var propertyArg5 = propertyDataAttribute5.GenerateDataSources(new DataGeneratorMetadata\n{\n Type = TUnit.Core.Enums.DataGeneratorType.Property,\n TestClassType = testClassType,\n ParameterInfos = null,\n PropertyInfo = propertyInfo5,\n TestBuilderContext = testBuilderContextAccessor,\n TestSessionId = sessionId,\n}).ElementAtOrDefault(0)();"); - // Static - await AssertFileContains(generatedFiles[0], "var propertyInfo6 = testClassType.GetProperty(\"StaticProperty\", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);"); - await AssertFileContains(generatedFiles[0], "var propertyDataAttribute6 = propertyInfo6.GetCustomAttributes>(true).ElementAt(0);"); - await AssertFileContains(generatedFiles[0], "var propertyArg6 = propertyDataAttribute6.GenerateDataSources(new DataGeneratorMetadata\n{\n Type = TUnit.Core.Enums.DataGeneratorType.Property,\n TestClassType = testClassType,\n ParameterInfos = null,\n PropertyInfo = propertyInfo6,\n TestBuilderContext = testBuilderContextAccessor,\n TestSessionId = sessionId,\n}).ElementAtOrDefault(0)();"); - await AssertFileContains(generatedFiles[0], "global::TUnit.TestProject.PropertySetterTests.StaticProperty = propertyArg6;"); - - await AssertFileContains(generatedFiles[0], "Property1 = propertyArg,"); - await AssertFileContains(generatedFiles[0], "Property2 = propertyArg1,"); - await AssertFileContains(generatedFiles[0], "Property3 = propertyArg2,"); - await AssertFileContains(generatedFiles[0], "Property4 = propertyArg3,"); - await AssertFileContains(generatedFiles[0], "Property5 = propertyArg4,"); - await AssertFileContains(generatedFiles[0], "Property6 = propertyArg5,"); - - await AssertFileContains(generatedFiles[0], "TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3, propertyArg4, propertyArg5],"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ReferencesHelper.cs b/TUnit.Core.SourceGenerator.Tests/ReferencesHelper.cs index 31060841b6..0d372ca5d7 100644 --- a/TUnit.Core.SourceGenerator.Tests/ReferencesHelper.cs +++ b/TUnit.Core.SourceGenerator.Tests/ReferencesHelper.cs @@ -1,8 +1,10 @@ -using Microsoft.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; +using Microsoft.CodeAnalysis; using TUnit.TestProject.Library; namespace TUnit.Core.SourceGenerator.Tests; +[SuppressMessage("SingleFile", "IL3000:Avoid accessing Assembly file path when publishing as a single file")] internal class ReferencesHelper { public static readonly List References = diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt new file mode 100644 index 0000000000..efdf228ea3 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt @@ -0,0 +1,682 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new RepeatTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.RepeatTests); + var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("One", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.RepeatTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.RepeatTests.One:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 1, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.One()), + TestFilePath = @"", + TestLineNumber = 6, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.RepeatAttribute(1) +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.RepeatAttribute(3) +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.RepeatTests.One:0", + TestClass = typeof(global::TUnit.TestProject.RepeatTests), + ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("One", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "One", + TestFilePath = @"", + TestLineNumber = 6, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.RepeatTests); + var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("One", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.RepeatTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.RepeatTests.One:1", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 1, + RepeatLimit = 1, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.One()), + TestFilePath = @"", + TestLineNumber = 6, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.RepeatAttribute(1) +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.RepeatAttribute(3) +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.RepeatTests.One:1", + TestClass = typeof(global::TUnit.TestProject.RepeatTests), + ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("One", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "One", + TestFilePath = @"", + TestLineNumber = 6, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new RepeatTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.RepeatTests); + var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.RepeatTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.RepeatTests.Two:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 2, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Two()), + TestFilePath = @"", + TestLineNumber = 13, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.RepeatAttribute(2) +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.RepeatAttribute(3) +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.RepeatTests.Two:0", + TestClass = typeof(global::TUnit.TestProject.RepeatTests), + ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Two", + TestFilePath = @"", + TestLineNumber = 13, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.RepeatTests); + var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.RepeatTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.RepeatTests.Two:1", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 1, + RepeatLimit = 2, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Two()), + TestFilePath = @"", + TestLineNumber = 13, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.RepeatAttribute(2) +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.RepeatAttribute(3) +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.RepeatTests.Two:1", + TestClass = typeof(global::TUnit.TestProject.RepeatTests), + ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Two", + TestFilePath = @"", + TestLineNumber = 13, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.RepeatTests); + var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.RepeatTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.RepeatTests.Two:2", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 2, + RepeatLimit = 2, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Two()), + TestFilePath = @"", + TestLineNumber = 13, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.RepeatAttribute(2) +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.RepeatAttribute(3) +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.RepeatTests.Two:2", + TestClass = typeof(global::TUnit.TestProject.RepeatTests), + ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Two", + TestFilePath = @"", + TestLineNumber = 13, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new RepeatTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.RepeatTests); + var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.RepeatTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.RepeatTests.Three:0", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 3, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Three()), + TestFilePath = @"", + TestLineNumber = 20, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.RepeatAttribute(3) +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.RepeatTests.Three:0", + TestClass = typeof(global::TUnit.TestProject.RepeatTests), + ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Three", + TestFilePath = @"", + TestLineNumber = 20, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.RepeatTests); + var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.RepeatTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.RepeatTests.Three:1", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 1, + RepeatLimit = 3, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Three()), + TestFilePath = @"", + TestLineNumber = 20, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.RepeatAttribute(3) +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.RepeatTests.Three:1", + TestClass = typeof(global::TUnit.TestProject.RepeatTests), + ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Three", + TestFilePath = @"", + TestLineNumber = 20, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.RepeatTests); + var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.RepeatTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.RepeatTests.Three:2", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 2, + RepeatLimit = 3, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Three()), + TestFilePath = @"", + TestLineNumber = 20, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.RepeatAttribute(3) +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.RepeatTests.Three:2", + TestClass = typeof(global::TUnit.TestProject.RepeatTests), + ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Three", + TestFilePath = @"", + TestLineNumber = 20, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.RepeatTests); + var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.RepeatTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"TUnit.TestProject.RepeatTests.Three:3", + TestClassArguments = [], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 3, + RepeatLimit = 3, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Three()), + TestFilePath = @"", + TestLineNumber = 20, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.RepeatAttribute(3) +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"TUnit.TestProject.RepeatTests.Three:3", + TestClass = typeof(global::TUnit.TestProject.RepeatTests), + ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []).ReturnType, + ParameterTypeFullNames = [], + TestName = "Three", + TestFilePath = @"", + TestLineNumber = 20, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.cs b/TUnit.Core.SourceGenerator.Tests/RepeatTests.cs index d9aa216183..751ed60661 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.cs @@ -12,29 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(3); - - await AssertFileContains(generatedFiles[0], "RepeatLimit = 1,"); - await AssertFileContains(generatedFiles[0], "RepeatLimit = 1,"); - - await AssertFileContains(generatedFiles[1], "RepeatLimit = 2,"); - await AssertFileContains(generatedFiles[1], "RepeatLimit = 2,"); - await AssertFileContains(generatedFiles[1], "RepeatLimit = 2,"); - - await AssertFileContains(generatedFiles[2], "RepeatLimit = 3,"); - await AssertFileContains(generatedFiles[2], "RepeatLimit = 3,"); - await AssertFileContains(generatedFiles[2], "RepeatLimit = 3,"); - await AssertFileContains(generatedFiles[2], "RepeatLimit = 3,"); - - await AssertFileContains(generatedFiles[0], "CurrentRepeatAttempt = 0,"); - await AssertFileContains(generatedFiles[0], "CurrentRepeatAttempt = 1,"); - - await AssertFileContains(generatedFiles[1], "CurrentRepeatAttempt = 0,"); - await AssertFileContains(generatedFiles[1], "CurrentRepeatAttempt = 1,"); - await AssertFileContains(generatedFiles[1], "CurrentRepeatAttempt = 2,"); - - await AssertFileContains(generatedFiles[2], "CurrentRepeatAttempt = 0,"); - await AssertFileContains(generatedFiles[2], "CurrentRepeatAttempt = 1,"); - await AssertFileContains(generatedFiles[2], "CurrentRepeatAttempt = 2,"); - await AssertFileContains(generatedFiles[2], "CurrentRepeatAttempt = 3,"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.Test.verified.txt new file mode 100644 index 0000000000..b954ee6f12 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.Test.verified.txt @@ -0,0 +1,111 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_STAThreadTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_STAThreadTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.STAThreadTests).GetMethod("BeforeTest", 0, []), + Body = (classInstance, context, cancellationToken) => classInstance.BeforeTest(), + HookExecutor = new global::TUnit.Core.STAThreadExecutor(), + Order = 0, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_STAThreadTests : TUnit.Core.Interfaces.SourceGenerator.ITestHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_STAThreadTests(); + SourceRegistrar.RegisterTestHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterEveryTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectBeforeTestHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList CollectAfterTestHooks(string sessionId) + { + return + [ + new InstanceHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.STAThreadTests).GetMethod("AfterTest", 0, []), + Body = (classInstance, context, cancellationToken) => classInstance.AfterTest(), + HookExecutor = new global::TUnit.Core.STAThreadExecutor(), + Order = 0, + }, + ]; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.cs b/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.cs index bc614654f0..dbd180039b 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.cs @@ -12,9 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(2); - - await AssertFileContains(generatedFiles[0], "HookExecutor = new global::TUnit.Core.STAThreadExecutor(),"); - - await AssertFileContains(generatedFiles[1], "HookExecutor = new global::TUnit.Core.STAThreadExecutor(),"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt new file mode 100644 index 0000000000..82487ae4d1 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt @@ -0,0 +1,1490 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new StringArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ..Tests4(sessionId), + ..Tests5(sessionId), + ..Tests6(sessionId), + ..Tests7(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = ""; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Normal(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(""" + Hello + World + """) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Normal", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = @"\"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Normal(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(""" + Hello + World + """) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Normal", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = @"\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Normal(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(""" + Hello + World + """) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Normal", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS3:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Normal(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(""" + Hello + World + """) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS3:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Normal", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests4(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "\\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS4:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Normal(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(""" + Hello + World + """) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS4:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Normal", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests5(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "\\\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS5:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Normal(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(""" + Hello + World + """) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS5:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Normal", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests6(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "\\\\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS6:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Normal(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(""" + Hello + World + """) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS6:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Normal", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests7(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = """ + Hello + World + """; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS7:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Normal(methodArg)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(""" + Hello + World + """) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS7:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Normal", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new StringArgumentTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ..Tests4(sessionId), + ..Tests5(sessionId), + ..Tests6(sessionId), + ..Tests7(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = ""; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Nullable(methodArg)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Nullable", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = @"\"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Nullable(methodArg)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Nullable", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = @"\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Nullable(methodArg)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Nullable", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS3:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Nullable(methodArg)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS3:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Nullable", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests4(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "\\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS4:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Nullable(methodArg)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS4:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Nullable", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests5(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "\\\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS5:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Nullable(methodArg)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS5:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Nullable", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests6(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = "\\\\t"; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS6:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Nullable(methodArg)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS6:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Nullable", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests7(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); + var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + global::System.String methodArg = null; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.StringArgumentTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS7:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClassArguments = [], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Nullable(methodArg)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute("") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(@"\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute("\\\\t") +{ + +}, new global::TUnit.Core.ArgumentsAttribute(null) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS7:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", + TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), + ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.String)], + TestName = "Nullable", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.cs b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.cs index 520c74a230..9b37d39aee 100644 --- a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.cs @@ -12,48 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(2); - - await AssertFileContains(generatedFiles[0], - """ - global::System.String methodArg = ""; - """); - - await AssertFileContains(generatedFiles[0], - """ - global::System.String methodArg = @"\"; - """); - - await AssertFileContains(generatedFiles[0], - """ - global::System.String methodArg = @"\t"; - """); - - await AssertFileContains(generatedFiles[0], - """ - global::System.String methodArg = "\t"; - """); - - await AssertFileContains(generatedFiles[0], - """ - global::System.String methodArg = "\\t"; - """); - - await AssertFileContains(generatedFiles[0], - """ - global::System.String methodArg = "\\\t"; - """); - - await AssertFileContains(generatedFiles[0], - """ - global::System.String methodArg = "\\\\t"; - """); - - await AssertFileContains(generatedFiles[0], - """" - global::System.String methodArg = """ - Hello - World - """; - """"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/TUnit.Core.SourceGenerator.Tests.csproj b/TUnit.Core.SourceGenerator.Tests/TUnit.Core.SourceGenerator.Tests.csproj index 8a227db7a9..cf34c00c2c 100644 --- a/TUnit.Core.SourceGenerator.Tests/TUnit.Core.SourceGenerator.Tests.csproj +++ b/TUnit.Core.SourceGenerator.Tests/TUnit.Core.SourceGenerator.Tests.csproj @@ -2,32 +2,18 @@ false - TUnit.Core.SourceGenerator.Tests + true + Exe + true + true + false - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - + - - - %(Filename)%(Extension) - PreserveNewest - + \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt new file mode 100644 index 0000000000..17e4f712fd --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt @@ -0,0 +1,91 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_TestDiscoveryHookTests : TUnit.Core.Interfaces.SourceGenerator.ITestDiscoveryHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_TestDiscoveryHookTests(); + SourceRegistrar.RegisterTestDiscoveryHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeTestDiscoveryHooks(string sessionId) + { + return + [ + new global::TUnit.Core.Hooks.BeforeTestDiscoveryHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.TestDiscoveryHookTests).GetMethod("BeforeDiscovery", 0, []), + Body = (context, cancellationToken) => global::TUnit.TestProject.TestDiscoveryHookTests.BeforeDiscovery(), + HookExecutor = DefaultExecutor.Instance, + Order = 5, + FilePath = @"", + LineNumber = 5, + }, + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterTestDiscoveryHooks(string sessionId) + { + return + [ + ]; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::System.Runtime.CompilerServices; +using global::TUnit.Core; +using global::TUnit.Core.Hooks; +using global::TUnit.Core.Interfaces; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class Hooks_TestDiscoveryHookTests : TUnit.Core.Interfaces.SourceGenerator.ITestDiscoveryHookSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + var instance = new Hooks_TestDiscoveryHookTests(); + SourceRegistrar.RegisterTestDiscoveryHookSource(instance); + } + public global::System.Collections.Generic.IReadOnlyList> CollectBeforeTestDiscoveryHooks(string sessionId) + { + return + [ + ]; + } + public global::System.Collections.Generic.IReadOnlyList> CollectAfterTestDiscoveryHooks(string sessionId) + { + return + [ + new global::TUnit.Core.Hooks.AfterTestDiscoveryHookMethod + { + MethodInfo = typeof(global::TUnit.TestProject.TestDiscoveryHookTests).GetMethod("AfterDiscovery", 0, []), + Body = (context, cancellationToken) => global::TUnit.TestProject.TestDiscoveryHookTests.AfterDiscovery(), + HookExecutor = DefaultExecutor.Instance, + Order = 0, + FilePath = @"", + LineNumber = 10, + }, + ]; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.cs b/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.cs index 0593fc3825..c7b1488212 100644 --- a/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.cs @@ -12,31 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles).HasCount().EqualTo(2); - - await AssertFileContains(generatedFiles[0], - """ - new global::TUnit.Core.Hooks.BeforeTestDiscoveryHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.TestDiscoveryHookTests).GetMethod("BeforeDiscovery", 0, []), - Body = (context, cancellationToken) => global::TUnit.TestProject.TestDiscoveryHookTests.BeforeDiscovery(), - HookExecutor = DefaultExecutor.Instance, - Order = 5, - FilePath = @"", - LineNumber = 5, - }, - """); - - await AssertFileContains(generatedFiles[1], - """ - new global::TUnit.Core.Hooks.AfterTestDiscoveryHookMethod - { - MethodInfo = typeof(global::TUnit.TestProject.TestDiscoveryHookTests).GetMethod("AfterDiscovery", 0, []), - Body = (context, cancellationToken) => global::TUnit.TestProject.TestDiscoveryHookTests.AfterDiscovery(), - HookExecutor = DefaultExecutor.Instance, - Order = 0, - FilePath = @"", - LineNumber = 10, - }, - """); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/TestsBase.cs b/TUnit.Core.SourceGenerator.Tests/TestsBase.cs index ae9d161999..4354da3b25 100644 --- a/TUnit.Core.SourceGenerator.Tests/TestsBase.cs +++ b/TUnit.Core.SourceGenerator.Tests/TestsBase.cs @@ -88,6 +88,8 @@ Have you added required references and additional files? } await assertions(generatedFiles); + + await Verify(generatedFiles); } private static bool IsError(Diagnostic x) @@ -104,9 +106,4 @@ private static bool IsError(Diagnostic x) return false; } - - protected async Task AssertFileContains(string file, string expected, [CallerArgumentExpression("file")] string fileExpression = "", [CallerArgumentExpression("expected")] string expectedExpression = "") - { - await Assert.That(file, fileExpression).Contains(expected, expectedExpression).IgnoringWhitespace(); - } } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt new file mode 100644 index 0000000000..43fbfe5ea3 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt @@ -0,0 +1,748 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new TimeoutCancellationTokenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DefaultTest", 0, [typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.TimeoutCancellationTokenTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).DefaultTest(System.Threading.CancellationToken):0", + TestClassArguments = [classArg], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DefaultTest(cancellationToken)), + TestFilePath = @"", + TestLineNumber = 15, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("DataSource") +{ + +}, new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).DefaultTest(System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DefaultTest", 0, [typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Threading.CancellationToken)], + TestName = "DefaultTest", + TestFilePath = @"", + TestLineNumber = 15, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new TimeoutCancellationTokenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("BasicTest", 0, [typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.TimeoutCancellationTokenTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).BasicTest(System.Threading.CancellationToken):0", + TestClassArguments = [classArg], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.BasicTest(cancellationToken)), + TestFilePath = @"", + TestLineNumber = 21, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.TimeoutAttribute(5_000) +{ + +}, new global::TUnit.Core.CategoryAttribute("Blah") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("DataSource") +{ + +}, new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).BasicTest(System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("BasicTest", 0, [typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Threading.CancellationToken)], + TestName = "BasicTest", + TestFilePath = @"", + TestLineNumber = 21, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new TimeoutCancellationTokenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("InheritedTimeoutAttribute", 0, [typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.TimeoutCancellationTokenTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).InheritedTimeoutAttribute(System.Threading.CancellationToken):0", + TestClassArguments = [classArg], + TestMethodArguments = [], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.InheritedTimeoutAttribute(cancellationToken)), + TestFilePath = @"", + TestLineNumber = 29, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.TestProject.TimeoutCancellationTokenTests.FiveSecondTimeout() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("DataSource") +{ + +}, new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).InheritedTimeoutAttribute(System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("InheritedTimeoutAttribute", 0, [typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Threading.CancellationToken)], + TestName = "InheritedTimeoutAttribute", + TestFilePath = @"", + TestLineNumber = 29, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new TimeoutCancellationTokenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + + global::System.Int32 methodArg = 1; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.TimeoutCancellationTokenTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).DataTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataTest(methodArg, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 36, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.ArgumentsAttribute(1) +{ + +}, new global::TUnit.Core.TimeoutAttribute(5_000) +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("DataSource") +{ + +}, new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).DataTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "DataTest", + TestFilePath = @"", + TestLineNumber = 36, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new TimeoutCancellationTokenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataSourceTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + + global::System.Int32 methodArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.TimeoutCancellationTokenTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).DataSourceTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceTest(methodArg, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 47, + TestAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("DataSource") +{ + +}, new global::TUnit.Core.TimeoutAttribute(5_000) +{ + +}, new global::TUnit.Core.TestAttribute() +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("DataSource") +{ + +}, new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).DataSourceTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataSourceTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "DataSourceTest", + TestFilePath = @"", + TestLineNumber = 47, + Exception = exception, + }); + } + return nodes; + } +} + + +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new TimeoutCancellationTokenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + + global::System.Int32 methodArg = 1; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.TimeoutCancellationTokenTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TL-ARGS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).MatrixTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest(methodArg, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 54, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.TimeoutAttribute(5_000) +{ + +}, new global::TUnit.Core.CategoryAttribute("Blah") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("DataSource") +{ + +}, new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TL-ARGS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).MatrixTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "MatrixTest", + TestFilePath = @"", + TestLineNumber = 54, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + + global::System.Int32 methodArg = 2; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.TimeoutCancellationTokenTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TL-ARGS1:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).MatrixTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest(methodArg, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 54, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.TimeoutAttribute(5_000) +{ + +}, new global::TUnit.Core.CategoryAttribute("Blah") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("DataSource") +{ + +}, new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TL-ARGS1:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).MatrixTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "MatrixTest", + TestFilePath = @"", + TestLineNumber = 54, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); + var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + global::System.Int32 classArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + + global::System.Int32 methodArg = 3; + + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.TimeoutCancellationTokenTests(classArg) + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TL-ARGS2:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).MatrixTest(System.Int32,System.Threading.CancellationToken):0", + TestClassArguments = [classArg], + TestMethodArguments = [methodArg], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest(methodArg, cancellationToken)), + TestFilePath = @"", + TestLineNumber = 54, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.TimeoutAttribute(5_000) +{ + +}, new global::TUnit.Core.CategoryAttribute("Blah") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("DataSource") +{ + +}, new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TL-ARGS2:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).MatrixTest(System.Int32,System.Threading.CancellationToken):0", + TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], + TestName = "MatrixTest", + TestFilePath = @"", + TestLineNumber = 54, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.cs b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.cs index 85e6d12f54..16ce739742 100644 --- a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.cs @@ -12,34 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(6); - - await AssertFileContains(generatedFiles[0], "TestName = \"DefaultTest\""); - await AssertFileContains(generatedFiles[0], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DefaultTest(cancellationToken))"); - - await AssertFileContains(generatedFiles[1], "TestName = \"BasicTest\""); - await AssertFileContains(generatedFiles[1], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.BasicTest(cancellationToken))"); - - await AssertFileContains(generatedFiles[2], "TestName = \"InheritedTimeoutAttribute\""); - await AssertFileContains(generatedFiles[2], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.InheritedTimeoutAttribute(cancellationToken))"); - - await AssertFileContains(generatedFiles[3], "TestName = \"DataTest\""); - await AssertFileContains(generatedFiles[3], "global::System.Int32 methodArg = 1;"); - await AssertFileContains(generatedFiles[3], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataTest(methodArg, cancellationToken))"); - - await AssertFileContains(generatedFiles[4], "TestName = \"DataSourceTest\""); - await AssertFileContains(generatedFiles[4], "global::System.Int32 methodArg = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource();"); - await AssertFileContains(generatedFiles[4], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSourceTest(methodArg, cancellationToken))"); - - await AssertFileContains(generatedFiles[5], "TestName = \"MatrixTest\""); - await AssertFileContains(generatedFiles[5], "global::System.Int32 methodArg = 1;"); - await AssertFileContains(generatedFiles[5], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest(methodArg, cancellationToken))"); - - await AssertFileContains(generatedFiles[5], "TestName = \"MatrixTest\""); - await AssertFileContains(generatedFiles[5], "global::System.Int32 methodArg = 2;"); - await AssertFileContains(generatedFiles[5], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest(methodArg, cancellationToken))"); - - await AssertFileContains(generatedFiles[5], "TestName = \"MatrixTest\""); - await AssertFileContains(generatedFiles[5], "global::System.Int32 methodArg = 3;"); - await AssertFileContains(generatedFiles[5], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.MatrixTest(methodArg, cancellationToken))"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt new file mode 100644 index 0000000000..716e310d7d --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt @@ -0,0 +1,94 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class TupleDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new TupleDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return Tests0(sessionId); + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); + var methodInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.TupleDataSourceDrivenTests() + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 5, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + ReturnType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 5, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.cs b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.cs index 7714ae59f2..6fe4493269 100644 --- a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.cs @@ -12,12 +12,5 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - - await AssertFileContains(generatedFiles[0], "var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod());"); - await AssertFileContains(generatedFiles[0], "global::System.Int32 methodArg = methodArgTuples.Item1;"); - await AssertFileContains(generatedFiles[0], "global::System.String methodArg1 = methodArgTuples.Item2;"); - await AssertFileContains(generatedFiles[0], "global::System.Boolean methodArg2 = methodArgTuples.Item3;"); - await AssertFileContains(generatedFiles[0], "TestMethodArguments = [methodArg, methodArg1, methodArg2],"); - await AssertFileContains(generatedFiles[0], "TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2))"); }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TestSourceDataModelRetriever.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TestSourceDataModelRetriever.cs index e54132a13e..36219fe979 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TestSourceDataModelRetriever.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TestSourceDataModelRetriever.cs @@ -1,5 +1,6 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; using TUnit.Core.SourceGenerator.Enums; using TUnit.Core.SourceGenerator.Extensions; using TUnit.Core.SourceGenerator.Models; @@ -35,7 +36,7 @@ public static IEnumerable ParseTestDatas(this IMethodSymbol { foreach (var classArguments in classArgumentsContainers) { - foreach (var testSourceDataModel in GenerateTestSourceDataModels(methodSymbol, namedTypeSymbol, classArguments, runCount, testAttribute, testArguments, propertyArgumentsContainer)) + foreach (var testSourceDataModel in GenerateTestSourceDataModels(context, methodSymbol, namedTypeSymbol, classArguments, runCount, testAttribute, testArguments, propertyArgumentsContainer)) { yield return testSourceDataModel; } @@ -48,12 +49,14 @@ private static IEnumerable GetClassAttributes(INamedTypeSymbol na return namedTypeSymbol.GetSelfAndBaseTypes().SelectMany(t => t.GetAttributes()); } - private static IEnumerable GenerateTestSourceDataModels(IMethodSymbol methodSymbol, INamedTypeSymbol namedTypeSymbol, - BaseContainer classArguments, int runCount, AttributeData testAttribute, BaseContainer testArguments, ClassPropertiesContainer classPropertiesContainer) + private static IEnumerable GenerateTestSourceDataModels( + GeneratorAttributeSyntaxContext context, IMethodSymbol methodSymbol, INamedTypeSymbol namedTypeSymbol, + BaseContainer classArguments, int runCount, AttributeData testAttribute, BaseContainer testArguments, + ClassPropertiesContainer classPropertiesContainer) { if (classArguments is EmptyArgumentsContainer) { - foreach (var testSourceDataModel in GenerateSingleClassInstance(methodSymbol, namedTypeSymbol, runCount, testAttribute, testArguments, classPropertiesContainer)) + foreach (var testSourceDataModel in GenerateSingleClassInstance(context, methodSymbol, namedTypeSymbol, runCount, testAttribute, testArguments, classPropertiesContainer)) { yield return testSourceDataModel; } @@ -61,14 +64,15 @@ private static IEnumerable GenerateTestSourceDataModels(IMe yield break; } - foreach (var generateMultipleClassInstance in GenerateMultipleClassInstances(methodSymbol, namedTypeSymbol, runCount, testAttribute, + foreach (var generateMultipleClassInstance in GenerateMultipleClassInstances(context, methodSymbol, namedTypeSymbol, runCount, testAttribute, classArguments, testArguments, classPropertiesContainer)) { yield return generateMultipleClassInstance; } } - private static IEnumerable GenerateSingleClassInstance(IMethodSymbol methodSymbol, + private static IEnumerable GenerateSingleClassInstance(GeneratorAttributeSyntaxContext context, + IMethodSymbol methodSymbol, INamedTypeSymbol namedTypeSymbol, int runCount, AttributeData testAttribute, BaseContainer testArguments, ClassPropertiesContainer classPropertiesContainer) @@ -77,18 +81,20 @@ private static IEnumerable GenerateSingleClassInstance(IMet { yield return GetTestSourceDataModel(new TestGenerationContext { - MethodSymbol = methodSymbol, - ClassSymbol = namedTypeSymbol, - ClassArguments = new EmptyArgumentsContainer(), - TestArguments = testArguments, - CurrentRepeatAttempt = i, - TestAttribute = testAttribute, - PropertyArguments = classPropertiesContainer - }); + Context = context, + MethodSymbol = methodSymbol, + ClassSymbol = namedTypeSymbol, + ClassArguments = new EmptyArgumentsContainer(), + TestArguments = testArguments, + CurrentRepeatAttempt = i, + TestAttribute = testAttribute, + PropertyArguments = classPropertiesContainer + }); } } - private static IEnumerable GenerateMultipleClassInstances(IMethodSymbol methodSymbol, + private static IEnumerable GenerateMultipleClassInstances( + GeneratorAttributeSyntaxContext context, IMethodSymbol methodSymbol, INamedTypeSymbol namedTypeSymbol, int runCount, AttributeData testAttribute, BaseContainer classArguments, BaseContainer testArguments, ClassPropertiesContainer classPropertiesContainer) @@ -97,6 +103,7 @@ private static IEnumerable GenerateMultipleClassInstances(I { yield return GetTestSourceDataModel(new TestGenerationContext { + Context = context, MethodSymbol = methodSymbol, ClassSymbol = namedTypeSymbol, ClassArguments = classArguments, @@ -116,11 +123,15 @@ private static TestSourceDataModel GetTestSourceDataModel(TestGenerationContext var testArguments = testGenerationContext.TestArguments; var testAttribute = testGenerationContext.TestAttribute; + var testAttributes = methodSymbol.GetAttributes(); + var classAttributes = namedTypeSymbol.GetAttributesIncludingBaseTypes().ToImmutableArray(); + var assemblyAttributes = namedTypeSymbol.ContainingAssembly.GetAttributes(); + AttributeData[] allAttributes = [ - ..methodSymbol.GetAttributes().Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime"), - ..namedTypeSymbol.GetAttributesIncludingBaseTypes().Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime"), - ..namedTypeSymbol.ContainingAssembly.GetAttributes().Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime") + ..testAttributes.Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime"), + ..classAttributes.Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime"), + ..assemblyAttributes.Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime") ]; var propertyAttributes = testGenerationContext.PropertyArguments @@ -157,11 +168,57 @@ private static TestSourceDataModel GetTestSourceDataModel(TestGenerationContext MethodParameterNames = [..methodSymbol.Parameters.Select(x => x.Name)], MethodGenericTypeCount = methodSymbol.TypeParameters.Length, TestExecutor = allAttributes.FirstOrDefault(x => x.AttributeClass?.IsOrInherits("global::TUnit.Core.Executors.TestExecutorAttribute") == true)?.AttributeClass?.TypeArguments.FirstOrDefault()?.GloballyQualified(), - AttributeTypes = allAttributes.Where(x => !x.IsDataSourceAttribute()).Select(x => x.AttributeClass?.GloballyQualified()).OfType().Distinct().ToArray(), + TestAttributes = WriteAttributes(testGenerationContext.Context, testAttributes), + ClassAttributes = WriteAttributes(testGenerationContext.Context, classAttributes), + AssemblyAttributes = WriteAttributes(testGenerationContext.Context, assemblyAttributes), PropertyAttributeTypes = propertyAttributes.Select(x => x.AttributeClass?.GloballyQualified()).OfType().ToArray(), PropertyArguments = testGenerationContext.PropertyArguments, }; } + + private static string[] WriteAttributes(GeneratorAttributeSyntaxContext context, ImmutableArray attributeDatas) + { + return attributeDatas + .Where(x => x.AttributeClass?.ContainingAssembly?.Name != "System.Runtime") + .Select(x => WriteAttribute(context, x)) + .Where(x => !string.IsNullOrEmpty(x)) + .ToArray(); + } + + private static string WriteAttribute(GeneratorAttributeSyntaxContext context, AttributeData attributeData) + { + if (attributeData.ApplicationSyntaxReference is null) + { + return string.Empty; + } + + var attributeSyntax = attributeData.ApplicationSyntaxReference.GetSyntax(); + + var constructorArgumentSyntaxes = attributeSyntax.DescendantNodes() + .OfType() + .Where(x => x.NameEquals is null); + + var typedConstantsToExpression = + constructorArgumentSyntaxes.Zip(attributeData.ConstructorArguments, (syntax, constant) => (syntax, constant)); + + var constructorArguments = typedConstantsToExpression.Select(x => + TypedConstantParser.GetTypedConstantValue(context.SemanticModel, x.syntax.Expression, x.constant.Type)); + + var namedArgSyntaxes = attributeSyntax.DescendantNodes() + .OfType() + .Where(x => x.NameEquals is not null) + .ToArray(); + + var namedArguments = attributeData.NamedArguments.Select(x => + $"{x.Key} = {TypedConstantParser.GetTypedConstantValue(context.SemanticModel, namedArgSyntaxes.First(stx => stx.NameEquals?.Name.Identifier.ValueText == x.Key).Expression, x.Value.Type)},"); + + return $$""" + new {{attributeData.AttributeClass!.GloballyQualified()}}({{string.Join(", ", constructorArguments)}}) + { + {{string.Join(" ", namedArguments)}} + } + """; + } private static IEnumerable GetNonGenericTypes(ImmutableArray methodSymbolParameters, string[] argumentTypes) diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/GenericTestInvocationWriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/GenericTestInvocationWriter.cs index b4bf570db5..6091ce1f72 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/GenericTestInvocationWriter.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/GenericTestInvocationWriter.cs @@ -75,7 +75,11 @@ public static void GenerateTestInvocationCode(SourceCodeWriter sourceBuilder, sourceBuilder.WriteLine($"TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.{testSourceDataModel.MethodName}({testSourceDataModel.MethodVariablesWithCancellationToken()})),"); sourceBuilder.WriteLine($"TestFilePath = @\"{testSourceDataModel.FilePath}\","); sourceBuilder.WriteLine($"TestLineNumber = {testSourceDataModel.LineNumber},"); - sourceBuilder.WriteLine($"AttributeTypes = [ {testSourceDataModel.AttributeTypes.Select(x => $"typeof({x})").ToCommaSeparatedString()} ],"); + + sourceBuilder.WriteLine($"TestAttributes = [ {testSourceDataModel.TestAttributes.ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine($"ClassAttributes = [ {testSourceDataModel.ClassAttributes.ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine($"AssemblyAttributes = [ {testSourceDataModel.AssemblyAttributes.ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine($"DataAttributes = [ {dataContainers.SelectMany(x => x.DataAttributesVariables).Select(x => x.Name).ToCommaSeparatedString()} ],"); sourceBuilder.WriteLine("TestBuilderContext = testBuilderContext,"); sourceBuilder.WriteLine("});"); diff --git a/TUnit.Core.SourceGenerator/Models/TestGenerationContext.cs b/TUnit.Core.SourceGenerator/Models/TestGenerationContext.cs index 73b9cfa361..8e54275590 100644 --- a/TUnit.Core.SourceGenerator/Models/TestGenerationContext.cs +++ b/TUnit.Core.SourceGenerator/Models/TestGenerationContext.cs @@ -12,4 +12,5 @@ public record TestGenerationContext public required BaseContainer ClassArguments { get; init; } public required ClassPropertiesContainer PropertyArguments { get; init; } public required int CurrentRepeatAttempt { get; init; } + public required GeneratorAttributeSyntaxContext Context { get; init; } } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator/Models/TestSourceDataModel.cs b/TUnit.Core.SourceGenerator/Models/TestSourceDataModel.cs index f2257ef365..15976d535b 100644 --- a/TUnit.Core.SourceGenerator/Models/TestSourceDataModel.cs +++ b/TUnit.Core.SourceGenerator/Models/TestSourceDataModel.cs @@ -64,7 +64,11 @@ public override int GetHashCode() public required int RepeatLimit { get; init; } public required string? TestExecutor { get; init; } - public required string[] AttributeTypes { get; init; } + + public required string[] TestAttributes { get; init; } + public required string[] ClassAttributes { get; init; } + public required string[] AssemblyAttributes { get; init; } + public required string[] PropertyAttributeTypes { get; init; } public required ClassPropertiesContainer PropertyArguments { get; init; } public required string AssemblyName { get; init; } diff --git a/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.csproj b/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.csproj index 61a3603f18..a768cd6433 100644 --- a/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.csproj +++ b/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.csproj @@ -23,7 +23,4 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - \ No newline at end of file diff --git a/TUnit.Core/TestMetadata.cs b/TUnit.Core/TestMetadata.cs index 081d6e1453..a4349b65ae 100644 --- a/TUnit.Core/TestMetadata.cs +++ b/TUnit.Core/TestMetadata.cs @@ -14,21 +14,17 @@ public override TestDetails BuildTestDetails() var methodInfo = MethodInfo; var classType = typeof(TClassType); - var methodAttributes = AttributeTypes.SelectMany(x => methodInfo.GetCustomAttributes(x, false)).Distinct().OfType().ToArray(); var dataAttributes = DataAttributes; - var typeAttributes = AttributeTypes.SelectMany(x => classType.GetCustomAttributes(x, true)).Distinct().OfType().Where(x => !x.IsDefaultAttribute()).ToArray(); - var assemblyAttributes = AttributeTypes.SelectMany(x => classType.Assembly.GetCustomAttributes(x, false)).Distinct().OfType().ToArray(); - Attribute[] attributes = [..methodAttributes, ..typeAttributes, ..assemblyAttributes]; - + Attribute[] attributes = [..TestAttributes, ..ClassAttributes, ..AssemblyAttributes]; var testDetails = new TestDetails { TestId = testId, LazyClassInstance = ResettableClassFactory!, ClassType = classType, - AssemblyAttributes = assemblyAttributes, - ClassAttributes = typeAttributes, - TestAttributes = methodAttributes, + AssemblyAttributes = AssemblyAttributes, + ClassAttributes = ClassAttributes, + TestAttributes = TestAttributes, DataAttributes = dataAttributes, Attributes = attributes, TestClassArguments = TestClassArguments, @@ -83,7 +79,9 @@ public abstract record TestMetadata public required object?[] TestClassProperties { get; init; } // Need to be referenced statically for AOT - public required Type[] AttributeTypes { get; init; } + public required Attribute[] TestAttributes { get; init; } + public required Attribute[] ClassAttributes { get; init; } + public required Attribute[] AssemblyAttributes { get; init; } public required Attribute[] DataAttributes { get; init; } diff --git a/TUnit.TestProject.Library/TUnit.TestProject.Library.csproj b/TUnit.TestProject.Library/TUnit.TestProject.Library.csproj index 6cae9bf356..297a1a0e86 100644 --- a/TUnit.TestProject.Library/TUnit.TestProject.Library.csproj +++ b/TUnit.TestProject.Library/TUnit.TestProject.Library.csproj @@ -12,5 +12,4 @@ - diff --git a/TUnit.UnitTests/TestExtensionsTests.cs b/TUnit.UnitTests/TestExtensionsTests.cs index 06dfc51ffb..4b3119c1ff 100644 --- a/TUnit.UnitTests/TestExtensionsTests.cs +++ b/TUnit.UnitTests/TestExtensionsTests.cs @@ -56,7 +56,9 @@ private TestMetadata CreateDummyMetadata() return _fixture.Build>() .Without(x => x.MethodInfo) .Without(x => x.ResettableClassFactory) - .With(x => x.AttributeTypes, []) + .With(x => x.TestAttributes, []) + .With(x => x.ClassAttributes, []) + .With(x => x.AssemblyAttributes, []) .With(x => x.DataAttributes, []) .Create(); }