diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt index 58a942219b..321c161bfc 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt @@ -45,24 +45,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "AssertClassName", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AssertClassName", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt index 2012faaff0..1dd47d15bd 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt @@ -63,24 +63,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SecondTest", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SecondTest", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -139,24 +132,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "AssertClassName", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AssertClassName", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -214,24 +200,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "AssertClassName", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AssertClassName", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt index f56a68c275..83d61f5099 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt @@ -72,42 +72,28 @@ internal static class TUnit_TestProject_AfterTests_CleanupTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test1", - FilePath = "", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test2", - FilePath = "", - LineNumber = 104, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.AfterTests.CleanupTests.Test1", + filePath: "", + lineNumber: 98, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.AfterTests.CleanupTests.Test2", + filePath: "", + lineNumber: 104, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt index f56a68c275..83d61f5099 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt @@ -72,42 +72,28 @@ internal static class TUnit_TestProject_AfterTests_CleanupTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test1", - FilePath = "", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test2", - FilePath = "", - LineNumber = 104, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.AfterTests.CleanupTests.Test1", + filePath: "", + lineNumber: 98, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.AfterTests.CleanupTests.Test2", + filePath: "", + lineNumber: 104, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt index 4535a0c14b..3f069d2188 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt @@ -500,205 +500,151 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "names", ne } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Params", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.Params", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Params", + fullyQualifiedName: "TUnit.TestProject.ArgsAsArrayTests.Params", + filePath: "", + lineNumber: 5, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ParamsEnumerable", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.ParamsEnumerable", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ParamsEnumerable", + fullyQualifiedName: "TUnit.TestProject.ArgsAsArrayTests.ParamsEnumerable", + filePath: "", + lineNumber: 15, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Following_Non_Params", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.Following_Non_Params", - FilePath = "", - LineNumber = 25, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Following_Non_Params", + fullyQualifiedName: "TUnit.TestProject.ArgsAsArrayTests.Following_Non_Params", + filePath: "", + lineNumber: 25, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "arg1", "arg2", "arg3"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonParamsStringArray", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.NonParamsStringArray", - FilePath = "", - LineNumber = 38, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonParamsStringArray", + fullyQualifiedName: "TUnit.TestProject.ArgsAsArrayTests.NonParamsStringArray", + filePath: "", + lineNumber: 38, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new object[]{"Chloe"}), new global::TUnit.Core.ArgumentsAttribute(new object[]{"Skipper","Lucy"}), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonParamsStringArray_SingleValue", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.NonParamsStringArray_SingleValue", - FilePath = "", - LineNumber = 47, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonParamsStringArray_SingleValue", + fullyQualifiedName: "TUnit.TestProject.ArgsAsArrayTests.NonParamsStringArray_SingleValue", + filePath: "", + lineNumber: 47, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Chloe"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonParamsStringArray_MultipleValues", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.NonParamsStringArray_MultipleValues", - FilePath = "", - LineNumber = 54, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonParamsStringArray_MultipleValues", + fullyQualifiedName: "TUnit.TestProject.ArgsAsArrayTests.NonParamsStringArray_MultipleValues", + filePath: "", + lineNumber: 54, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new object[]{"Skipper","Lucy"}), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonParamsIntArray", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.NonParamsIntArray", - FilePath = "", - LineNumber = 61, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonParamsIntArray", + fullyQualifiedName: "TUnit.TestProject.ArgsAsArrayTests.NonParamsIntArray", + filePath: "", + lineNumber: 61, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, 2, 3), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericStringArray", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.GenericStringArray", - FilePath = "", - LineNumber = 69, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericStringArray", + fullyQualifiedName: "TUnit.TestProject.ArgsAsArrayTests.GenericStringArray", + filePath: "", + lineNumber: 69, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new string[]{"Skipper","Lucy"}), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonParamsStringArray_BeyondStaticCaseCap", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.NonParamsStringArray_BeyondStaticCaseCap", - FilePath = "", - LineNumber = 78, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonParamsStringArray_BeyondStaticCaseCap", + fullyQualifiedName: "TUnit.TestProject.ArgsAsArrayTests.NonParamsStringArray_BeyondStaticCaseCap", + filePath: "", + lineNumber: 78, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("a", "b", "c", "d", "e", "f", "g", "h"), }, - }, + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt index 914fd38386..8d977f8461 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt @@ -97,54 +97,42 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProj } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Explicit", - FullyQualifiedName = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Explicit", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Explicit", + fullyQualifiedName: "TUnit.TestProject.ArgumentWithImplicitConverterTests.Explicit", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Implicit", - FullyQualifiedName = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Implicit", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Implicit", + fullyQualifiedName: "TUnit.TestProject.ArgumentWithImplicitConverterTests.Implicit", + filePath: "", + lineNumber: 17, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt index 9eb50f03f6..7244dbbf04 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt index 5a0a27ca49..e264c6562f 100644 --- a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt @@ -211,307 +211,139 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "AsyncMethodDataSource_SingleValue", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_SingleValue", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsyncMethodDataSource_SingleValue", + fullyQualifiedName: "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_SingleValue", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsyncMethodDataSource_Tuples", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Tuples", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsyncMethodDataSource_Tuples", + fullyQualifiedName: "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Tuples", + filePath: "", + lineNumber: 15, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithTuples") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithTuples(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithTuples()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsyncMethodDataSource_Enumerable", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Enumerable", - FilePath = "", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsyncMethodDataSource_Enumerable", + fullyQualifiedName: "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Enumerable", + filePath: "", + lineNumber: 23, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncEnumerableDataMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncEnumerableDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncEnumerableDataMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsyncMethodDataSource_Func", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Func", - FilePath = "", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsyncMethodDataSource_Func", + fullyQualifiedName: "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Func", + filePath: "", + lineNumber: 30, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncFuncDataMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncFuncDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncFuncDataMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsyncMethodDataSource_WithArguments", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_WithArguments", - FilePath = "", - LineNumber = 37, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsyncMethodDataSource_WithArguments", + fullyQualifiedName: "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_WithArguments", + filePath: "", + lineNumber: 37, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithArgs") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithArgs(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithArgs()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsyncMethodDataSource_ExternalClass", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_ExternalClass", - FilePath = "", - LineNumber = 44, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsyncMethodDataSource_ExternalClass", + fullyQualifiedName: "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_ExternalClass", + filePath: "", + lineNumber: 44, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.AsyncExternalDataSource), "GetData") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.AsyncExternalDataSource.GetData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.AsyncExternalDataSource.GetData()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskMethodDataSource_SingleValue", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskMethodDataSource_SingleValue", - FilePath = "", - LineNumber = 51, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskMethodDataSource_SingleValue", + fullyQualifiedName: "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskMethodDataSource_SingleValue", + filePath: "", + lineNumber: 51, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("ValueTaskDataMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskDataMethod()), }, }, - }, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt index f480a0994b..90327d194b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt @@ -73,24 +73,17 @@ internal static class TUnit_TestProject_AttributeTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "MyTest", - FullyQualifiedName = "TUnit.TestProject.AttributeTests.MyTest", - FilePath = "", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MyTest", + fullyQualifiedName: "TUnit.TestProject.AttributeTests.MyTest", + filePath: "", + lineNumber: 7, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt index 9eb50f03f6..7244dbbf04 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.cs b/TUnit.Core.SourceGenerator.Tests/BasicTests.cs index 5480a6bd76..26cfd8f19b 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.cs @@ -26,9 +26,16 @@ public Task Test() => RunTest(InputFile, var lineSpan = firstMethod.GetLocation().GetLineSpan(); var generatedCode = string.Join(Environment.NewLine, generatedFiles); - await Assert.That(generatedCode).Contains($"LineNumber = {lineSpan.StartLinePosition.Line + 1},"); - await Assert.That(generatedCode).Contains($"StartColumnNumber = {lineSpan.StartLinePosition.Character + 1},"); - await Assert.That(generatedCode).Contains($"EndLineNumber = {lineSpan.EndLinePosition.Line + 1},"); - await Assert.That(generatedCode).Contains($"EndColumnNumber = {lineSpan.EndLinePosition.Character + 1},"); + // TestEntry source locations are emitted as TestEntryFactory.Create named arguments + await Assert.That(generatedCode).Contains($"lineNumber: {lineSpan.StartLinePosition.Line + 1},"); + + // Column/end spans are environment-sensitive (zero when the span is unavailable) and + // the generator omits the argument entirely when zero, so assert values only when emitted. + if (generatedCode.Contains("startColumnNumber: ")) + { + await Assert.That(generatedCode).Contains($"startColumnNumber: {lineSpan.StartLinePosition.Character + 1},"); + await Assert.That(generatedCode).Contains($"endLineNumber: {lineSpan.EndLinePosition.Line + 1},"); + await Assert.That(generatedCode).Contains($"endColumnNumber: {lineSpan.EndLinePosition.Character + 1},"); + } }); } diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt index 96b78c795c..d18e8f5a87 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt @@ -72,42 +72,28 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test1", - FilePath = "", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test2", - FilePath = "", - LineNumber = 104, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.BeforeTests.SetupTests.Test1", + filePath: "", + lineNumber: 98, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.BeforeTests.SetupTests.Test2", + filePath: "", + lineNumber: 104, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt index 96b78c795c..d18e8f5a87 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt @@ -72,42 +72,28 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test1", - FilePath = "", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test2", - FilePath = "", - LineNumber = 104, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.BeforeTests.SetupTests.Test1", + filePath: "", + lineNumber: 98, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.BeforeTests.SetupTests.Test2", + filePath: "", + lineNumber: 104, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt index 0571b78eec..ff90e31a0f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt @@ -62,24 +62,17 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SimpleTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SimpleTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", + filePath: "", + lineNumber: 19, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt index 0571b78eec..ff90e31a0f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt @@ -62,24 +62,17 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SimpleTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SimpleTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", + filePath: "", + lineNumber: 19, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt index 0571b78eec..ff90e31a0f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt @@ -62,24 +62,17 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SimpleTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SimpleTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", + filePath: "", + lineNumber: 19, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt index 8efa2217e0..0931a2eb61 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt @@ -62,24 +62,17 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SimpleTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SimpleTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", + filePath: "", + lineNumber: 19, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.cs b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.cs index 97187bcef8..492ea98adf 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.cs +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.cs @@ -27,6 +27,9 @@ await Verify(scrubbedFiles) .ScrubLinesContaining("StartColumnNumber = ") .ScrubLinesContaining("EndLineNumber = ") .ScrubLinesContaining("EndColumnNumber = ") + .ScrubLinesContaining("startColumnNumber: ") + .ScrubLinesContaining("endLineNumber: ") + .ScrubLinesContaining("endColumnNumber: ") .UniqueForTargetFrameworkAndVersion(); }); diff --git a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt index be736c89b2..b193ce37d9 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt @@ -111,85 +111,67 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg2", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Simple", - FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.Simple", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Simple", + fullyQualifiedName: "TUnit.TestProject.ClassAndMethodArgumentsTests.Simple", + filePath: "", + lineNumber: 8, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("1"), new global::TUnit.Core.ArgumentsAttribute("2"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "WithMethodLevel", - FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.WithMethodLevel", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "WithMethodLevel", + fullyQualifiedName: "TUnit.TestProject.ClassAndMethodArgumentsTests.WithMethodLevel", + filePath: "", + lineNumber: 11, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("3"), new global::TUnit.Core.ArgumentsAttribute("4"), }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("1"), new global::TUnit.Core.ArgumentsAttribute("2"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IgnoreParameters", - FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.IgnoreParameters", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IgnoreParameters", + fullyQualifiedName: "TUnit.TestProject.ClassAndMethodArgumentsTests.IgnoreParameters", + filePath: "", + lineNumber: 16, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("3"), new global::TUnit.Core.ArgumentsAttribute("4"), }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("1"), new global::TUnit.Core.ArgumentsAttribute("2"), }, - }, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt index 59f7dc8750..ca2ede054f 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt @@ -79,24 +79,17 @@ internal static class TUnit_TestProject_ClassConstructorTest__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.ClassConstructorTest.Test", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.ClassConstructorTest.Test", + filePath: "", + lineNumber: 8, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt index 5ee9a39e1f..31e1a0f678 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt @@ -222,160 +222,118 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProj } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Class", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Class", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Class_Generic", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Class_Generic", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic", + filePath: "", + lineNumber: 16, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IsInitialized_With_1_ClassDataSource", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource", - FilePath = "", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IsInitialized_With_1_ClassDataSource", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource", + filePath: "", + lineNumber: 23, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IsInitialized_With_2_ClassDataSources", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources", - FilePath = "", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IsInitialized_With_2_ClassDataSources", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources", + filePath: "", + lineNumber: 30, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IsInitialized_With_3_ClassDataSources", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources", - FilePath = "", - LineNumber = 38, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IsInitialized_With_3_ClassDataSources", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources", + filePath: "", + lineNumber: 38, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IsInitialized_With_4_ClassDataSources", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources", - FilePath = "", - LineNumber = 47, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IsInitialized_With_4_ClassDataSources", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources", + filePath: "", + lineNumber: 47, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IsInitialized_With_5_ClassDataSources", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources", - FilePath = "", - LineNumber = 57, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IsInitialized_With_5_ClassDataSources", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources", + filePath: "", + lineNumber: 57, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt index 6924f61b0d..5105f4b729 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt @@ -80,52 +80,40 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Base_Derived1", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived1", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Base_Derived1", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived1", + filePath: "", + lineNumber: 12, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Base_Derived2", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived2", - FilePath = "", - LineNumber = 18, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Base_Derived2", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived2", + filePath: "", + lineNumber: 18, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt index 3fd86cb514..6166d69275 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt @@ -97,52 +97,40 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProj } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Class", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Class", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Class_Generic", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Class_Generic", + fullyQualifiedName: "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic", + filePath: "", + lineNumber: 16, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt index f32d351b13..309d21ea51 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt @@ -144,78 +144,40 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_TupleMethod", - FullyQualifiedName = "TUnit.TestProject.ClassTupleDataSourceDrivenTests.DataSource_TupleMethod", - FilePath = "", - LineNumber = 27, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_TupleMethod", + fullyQualifiedName: "TUnit.TestProject.ClassTupleDataSourceDrivenTests.DataSource_TupleMethod", + filePath: "", + lineNumber: 27, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()), }, }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt index 2012faaff0..1dd47d15bd 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt @@ -63,24 +63,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SecondTest", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SecondTest", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -139,24 +132,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "AssertClassName", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AssertClassName", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -214,24 +200,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "AssertClassName", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AssertClassName", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet10_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet10_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet8_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet8_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet9_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet9_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt index 9eb50f03f6..7244dbbf04 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet10_0.verified.txt index dc98ba5ca5..2eb35fa552 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet10_0.verified.txt @@ -321,234 +321,174 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 17, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), new global::TUnit.Core.ArgumentsAttribute(2, "String2"), new global::TUnit.Core.ArgumentsAttribute(3, "String3"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EnumValue", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), new global::TUnit.Core.ArgumentsAttribute(-1), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = "", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NullValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NullValue", + filePath: "", + lineNumber: 35, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EmptyString", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonEmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NonEmptyString", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = "", - LineNumber = 56, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "BooleanString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.BooleanString", + filePath: "", + lineNumber: 56, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), new global::TUnit.Core.ArgumentsAttribute(false), new global::TUnit.Core.ArgumentsAttribute(true), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = "", - LineNumber = 65, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Type", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.Type", + filePath: "", + lineNumber: 65, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = "", - LineNumber = 72, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntegerArray", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntegerArray", + filePath: "", + lineNumber: 72, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = "", - LineNumber = 79, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntMaxValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntMaxValue", + filePath: "", + lineNumber: 79, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), }, - }, + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet8_0.verified.txt index dc98ba5ca5..2eb35fa552 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet8_0.verified.txt @@ -321,234 +321,174 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 17, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), new global::TUnit.Core.ArgumentsAttribute(2, "String2"), new global::TUnit.Core.ArgumentsAttribute(3, "String3"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EnumValue", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), new global::TUnit.Core.ArgumentsAttribute(-1), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = "", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NullValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NullValue", + filePath: "", + lineNumber: 35, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EmptyString", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonEmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NonEmptyString", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = "", - LineNumber = 56, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "BooleanString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.BooleanString", + filePath: "", + lineNumber: 56, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), new global::TUnit.Core.ArgumentsAttribute(false), new global::TUnit.Core.ArgumentsAttribute(true), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = "", - LineNumber = 65, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Type", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.Type", + filePath: "", + lineNumber: 65, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = "", - LineNumber = 72, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntegerArray", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntegerArray", + filePath: "", + lineNumber: 72, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = "", - LineNumber = 79, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntMaxValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntMaxValue", + filePath: "", + lineNumber: 79, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), }, - }, + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet9_0.verified.txt index dc98ba5ca5..2eb35fa552 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet9_0.verified.txt @@ -321,234 +321,174 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 17, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), new global::TUnit.Core.ArgumentsAttribute(2, "String2"), new global::TUnit.Core.ArgumentsAttribute(3, "String3"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EnumValue", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), new global::TUnit.Core.ArgumentsAttribute(-1), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = "", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NullValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NullValue", + filePath: "", + lineNumber: 35, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EmptyString", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonEmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NonEmptyString", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = "", - LineNumber = 56, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "BooleanString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.BooleanString", + filePath: "", + lineNumber: 56, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), new global::TUnit.Core.ArgumentsAttribute(false), new global::TUnit.Core.ArgumentsAttribute(true), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = "", - LineNumber = 65, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Type", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.Type", + filePath: "", + lineNumber: 65, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = "", - LineNumber = 72, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntegerArray", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntegerArray", + filePath: "", + lineNumber: 72, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = "", - LineNumber = 79, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntMaxValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntMaxValue", + filePath: "", + lineNumber: 79, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), }, - }, + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt index e4632217d3..88e68fe5d8 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt @@ -321,234 +321,174 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 17, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), new global::TUnit.Core.ArgumentsAttribute(2, "String2"), new global::TUnit.Core.ArgumentsAttribute(3, "String3"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EnumValue", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), new global::TUnit.Core.ArgumentsAttribute(-1), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = "", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NullValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NullValue", + filePath: "", + lineNumber: 35, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EmptyString", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonEmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NonEmptyString", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = "", - LineNumber = 56, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "BooleanString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.BooleanString", + filePath: "", + lineNumber: 56, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), new global::TUnit.Core.ArgumentsAttribute(false), new global::TUnit.Core.ArgumentsAttribute(true), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = "", - LineNumber = 65, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Type", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.Type", + filePath: "", + lineNumber: 65, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = "", - LineNumber = 72, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntegerArray", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntegerArray", + filePath: "", + lineNumber: 72, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = "", - LineNumber = 79, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntMaxValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntMaxValue", + filePath: "", + lineNumber: 79, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), }, - }, + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt index a6ee568e38..b573510f62 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt @@ -372,292 +372,214 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProj } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_One", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_One", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Two", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Two", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = "", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Enum", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + filePath: "", + lineNumber: 30, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = "", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools", + filePath: "", + lineNumber: 40, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = "", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ImplicitConversion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ImplicitConversion", + filePath: "", + lineNumber: 58, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = "", - LineNumber = 67, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ExcludingAutoGeneratedMatrixValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + filePath: "", + lineNumber: 67, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = "", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method1", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method1", + filePath: "", + lineNumber: 116, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", - FilePath = "", - LineNumber = 124, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method2", + filePath: "", + lineNumber: 124, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = "", - LineNumber = 132, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method3", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method3", + filePath: "", + lineNumber: 132, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = "", - LineNumber = 140, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method4", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method4", + filePath: "", + lineNumber: 140, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = "", - LineNumber = 148, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Exclusion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Exclusion", + filePath: "", + lineNumber: 148, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = "", - LineNumber = 197, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_12, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 12, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + filePath: "", + lineNumber: 197, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_12, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 12, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet8_0.verified.txt index a6ee568e38..b573510f62 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet8_0.verified.txt @@ -372,292 +372,214 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProj } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_One", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_One", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Two", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Two", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = "", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Enum", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + filePath: "", + lineNumber: 30, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = "", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools", + filePath: "", + lineNumber: 40, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = "", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ImplicitConversion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ImplicitConversion", + filePath: "", + lineNumber: 58, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = "", - LineNumber = 67, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ExcludingAutoGeneratedMatrixValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + filePath: "", + lineNumber: 67, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = "", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method1", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method1", + filePath: "", + lineNumber: 116, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", - FilePath = "", - LineNumber = 124, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method2", + filePath: "", + lineNumber: 124, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = "", - LineNumber = 132, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method3", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method3", + filePath: "", + lineNumber: 132, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = "", - LineNumber = 140, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method4", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method4", + filePath: "", + lineNumber: 140, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = "", - LineNumber = 148, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Exclusion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Exclusion", + filePath: "", + lineNumber: 148, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = "", - LineNumber = 197, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_12, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 12, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + filePath: "", + lineNumber: 197, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_12, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 12, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet9_0.verified.txt index a6ee568e38..b573510f62 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet9_0.verified.txt @@ -372,292 +372,214 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProj } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_One", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_One", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Two", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Two", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = "", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Enum", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + filePath: "", + lineNumber: 30, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = "", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools", + filePath: "", + lineNumber: 40, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = "", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ImplicitConversion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ImplicitConversion", + filePath: "", + lineNumber: 58, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = "", - LineNumber = 67, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ExcludingAutoGeneratedMatrixValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + filePath: "", + lineNumber: 67, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = "", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method1", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method1", + filePath: "", + lineNumber: 116, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", - FilePath = "", - LineNumber = 124, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method2", + filePath: "", + lineNumber: 124, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = "", - LineNumber = 132, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method3", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method3", + filePath: "", + lineNumber: 132, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = "", - LineNumber = 140, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method4", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method4", + filePath: "", + lineNumber: 140, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = "", - LineNumber = 148, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Exclusion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Exclusion", + filePath: "", + lineNumber: 148, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = "", - LineNumber = 197, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_12, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 12, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + filePath: "", + lineNumber: 197, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_12, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 12, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.Net4_7.verified.txt index 19f225dadb..c8f45dedd7 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.Net4_7.verified.txt @@ -372,292 +372,214 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProj } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_One", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_One", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Two", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Two", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = "", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Enum", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + filePath: "", + lineNumber: 30, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = "", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools", + filePath: "", + lineNumber: 40, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = "", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ImplicitConversion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ImplicitConversion", + filePath: "", + lineNumber: 58, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = "", - LineNumber = 67, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ExcludingAutoGeneratedMatrixValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + filePath: "", + lineNumber: 67, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = "", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method1", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method1", + filePath: "", + lineNumber: 116, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", - FilePath = "", - LineNumber = 124, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method2", + filePath: "", + lineNumber: 124, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = "", - LineNumber = 132, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method3", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method3", + filePath: "", + lineNumber: 132, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = "", - LineNumber = 140, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method4", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method4", + filePath: "", + lineNumber: 140, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = "", - LineNumber = 148, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Exclusion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Exclusion", + filePath: "", + lineNumber: 148, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = "", - LineNumber = 197, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_12, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 12, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + filePath: "", + lineNumber: 197, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_12, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 12, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet10_0.verified.txt index f6709b10a7..e825a6dceb 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet10_0.verified.txt @@ -240,304 +240,158 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method2", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method_WithAction", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = "", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method3", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + filePath: "", + lineNumber: 33, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method4", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = "", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_WithBaseReturn", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + filePath: "", + lineNumber: 53, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = "", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumerableFuncArrayTest", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + filePath: "", + lineNumber: 59, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData()), }, }, - }, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet8_0.verified.txt index f6709b10a7..e825a6dceb 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet8_0.verified.txt @@ -240,304 +240,158 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method2", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method_WithAction", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = "", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method3", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + filePath: "", + lineNumber: 33, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method4", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = "", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_WithBaseReturn", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + filePath: "", + lineNumber: 53, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = "", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumerableFuncArrayTest", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + filePath: "", + lineNumber: 59, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData()), }, }, - }, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet9_0.verified.txt index f6709b10a7..e825a6dceb 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet9_0.verified.txt @@ -240,304 +240,158 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method2", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method_WithAction", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = "", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method3", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + filePath: "", + lineNumber: 33, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method4", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = "", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_WithBaseReturn", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + filePath: "", + lineNumber: 53, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = "", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumerableFuncArrayTest", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + filePath: "", + lineNumber: 59, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData()), }, }, - }, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.Net4_7.verified.txt index 72640c75c3..94309c4579 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.Net4_7.verified.txt @@ -240,304 +240,158 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method2", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method_WithAction", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = "", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method3", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + filePath: "", + lineNumber: 33, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method4", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = "", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_WithBaseReturn", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + filePath: "", + lineNumber: 53, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = "", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumerableFuncArrayTest", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + filePath: "", + lineNumber: 59, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData()), }, }, - }, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet10_0.verified.txt index aa67a031d6..ea9fde58aa 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet10_0.verified.txt @@ -75,39 +75,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_TupleMethod", - FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_TupleMethod", + fullyQualifiedName: "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet8_0.verified.txt index aa67a031d6..ea9fde58aa 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet8_0.verified.txt @@ -75,39 +75,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_TupleMethod", - FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_TupleMethod", + fullyQualifiedName: "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet9_0.verified.txt index aa67a031d6..ea9fde58aa 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet9_0.verified.txt @@ -75,39 +75,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_TupleMethod", - FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_TupleMethod", + fullyQualifiedName: "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.Net4_7.verified.txt index 410c92fe47..497b719094 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.Net4_7.verified.txt @@ -75,39 +75,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_TupleMethod", - FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_TupleMethod", + fullyQualifiedName: "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt index d758cada62..714ac98a41 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt @@ -210,160 +210,118 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "dummy", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "String1", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.String1", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "String1", + fullyQualifiedName: "TUnit.TestProject.ConstantArgumentsTests.String1", + filePath: "", + lineNumber: 16, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("123"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Int", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Int", - FilePath = "", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Int", + fullyQualifiedName: "TUnit.TestProject.ConstantArgumentsTests.Int", + filePath: "", + lineNumber: 23, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Double", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Double", - FilePath = "", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Double", + fullyQualifiedName: "TUnit.TestProject.ConstantArgumentsTests.Double", + filePath: "", + lineNumber: 30, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.23d), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Float", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Float", - FilePath = "", - LineNumber = 37, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Float", + fullyQualifiedName: "TUnit.TestProject.ConstantArgumentsTests.Float", + filePath: "", + lineNumber: 37, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.23000002f), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Long", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Long", - FilePath = "", - LineNumber = 44, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Long", + fullyQualifiedName: "TUnit.TestProject.ConstantArgumentsTests.Long", + filePath: "", + lineNumber: 44, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123L), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "UInt", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.UInt", - FilePath = "", - LineNumber = 51, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "UInt", + fullyQualifiedName: "TUnit.TestProject.ConstantArgumentsTests.UInt", + filePath: "", + lineNumber: 51, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123U), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ULong", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.ULong", - FilePath = "", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ULong", + fullyQualifiedName: "TUnit.TestProject.ConstantArgumentsTests.ULong", + filePath: "", + lineNumber: 58, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123UL), }, - }, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt index 1922d55e78..6ebaf54d8b 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt @@ -72,28 +72,22 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SomeTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests.SomeTest", - FilePath = "", - LineNumber = 13, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SomeTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests.SomeTest", + filePath: "", + lineNumber: 13, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Value"), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt index eda48adc16..bee7016865 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt @@ -72,28 +72,22 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SomeTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests.SomeTest", - FilePath = "", - LineNumber = 13, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SomeTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests.SomeTest", + filePath: "", + lineNumber: 13, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute($"{"Value"}1"), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/CustomAttributeInheritanceTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/CustomAttributeInheritanceTests.Test.verified.txt index 0782a6e4f0..f721450122 100644 --- a/TUnit.Core.SourceGenerator.Tests/CustomAttributeInheritanceTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/CustomAttributeInheritanceTests.Test.verified.txt @@ -63,24 +63,17 @@ internal static class TUnit_TestProject_CustomAttributeInheritanceTests__TestSou } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.CustomAttributeInheritanceTests.Test", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.CustomAttributeInheritanceTests.Test", + filePath: "", + lineNumber: 9, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt index 95ef296f39..e938036e4f 100644 --- a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt @@ -271,198 +271,131 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "password", n } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test2", - FilePath = "", - LineNumber = 18, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test3", - FilePath = "", - LineNumber = 25, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 2, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.CustomDisplayNameTests.Test", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.CustomDisplayNameTests.Test2", + filePath: "", + lineNumber: 18, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test3", + fullyQualifiedName: "TUnit.TestProject.CustomDisplayNameTests.Test3", + filePath: "", + lineNumber: 25, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("foo", 1, true), new global::TUnit.Core.ArgumentsAttribute("bar", 2, false), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MethodDataSourceTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.MethodDataSourceTest", - FilePath = "", - LineNumber = 37, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 3, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 2), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MethodDataSourceTest", + fullyQualifiedName: "TUnit.TestProject.CustomDisplayNameTests.MethodDataSourceTest", + filePath: "", + lineNumber: 37, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("Method") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CustomDisplayNameTests.Method(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.CustomDisplayNameTests.Method()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "TestParameterNamePrefixBug", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.TestParameterNamePrefixBug", - FilePath = "", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 4, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 3), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestParameterNamePrefixBug", + fullyQualifiedName: "TUnit.TestProject.CustomDisplayNameTests.TestParameterNamePrefixBug", + filePath: "", + lineNumber: 45, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(100, "Type1"), new global::TUnit.Core.ArgumentsAttribute(200, "Type2"), new global::TUnit.Core.ArgumentsAttribute(300, "Type1"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "PasswordTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.PasswordTest", - FilePath = "", - LineNumber = 65, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 5, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 4), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "PasswordTest", + fullyQualifiedName: "TUnit.TestProject.CustomDisplayNameTests.PasswordTest", + filePath: "", + lineNumber: 65, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.CustomDisplayNameTests.MyGenerator(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "SameClassConstantTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.SameClassConstantTest", - FilePath = "", - LineNumber = 72, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 6, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DifferentClassConstantTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.DifferentClassConstantTest", - FilePath = "", - LineNumber = 79, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 6, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NestedClassConstantTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.NestedClassConstantTest", - FilePath = "", - LineNumber = 86, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 6, - }, + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 5), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SameClassConstantTest", + fullyQualifiedName: "TUnit.TestProject.CustomDisplayNameTests.SameClassConstantTest", + filePath: "", + lineNumber: 72, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 6), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DifferentClassConstantTest", + fullyQualifiedName: "TUnit.TestProject.CustomDisplayNameTests.DifferentClassConstantTest", + filePath: "", + lineNumber: 79, + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 6), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NestedClassConstantTest", + fullyQualifiedName: "TUnit.TestProject.CustomDisplayNameTests.NestedClassConstantTest", + filePath: "", + lineNumber: 86, + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 6), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt index dc98ba5ca5..2eb35fa552 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt @@ -321,234 +321,174 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 17, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), new global::TUnit.Core.ArgumentsAttribute(2, "String2"), new global::TUnit.Core.ArgumentsAttribute(3, "String3"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EnumValue", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), new global::TUnit.Core.ArgumentsAttribute(-1), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = "", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NullValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NullValue", + filePath: "", + lineNumber: 35, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.EmptyString", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonEmptyString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.NonEmptyString", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = "", - LineNumber = 56, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "BooleanString", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.BooleanString", + filePath: "", + lineNumber: 56, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), new global::TUnit.Core.ArgumentsAttribute(false), new global::TUnit.Core.ArgumentsAttribute(true), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = "", - LineNumber = 65, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Type", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.Type", + filePath: "", + lineNumber: 65, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = "", - LineNumber = 72, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntegerArray", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntegerArray", + filePath: "", + lineNumber: 72, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = "", - LineNumber = 79, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "IntMaxValue", + fullyQualifiedName: "TUnit.TestProject.DataDrivenTests.IntMaxValue", + filePath: "", + lineNumber: 79, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), }, - }, + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt index 50ad873b70..9008ab9075 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt @@ -79,102 +79,48 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global: } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSourceClassCombinedWithDataSourceMethodTest", - FullyQualifiedName = "TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod.DataSourceClassCombinedWithDataSourceMethodTest", - FilePath = "", - LineNumber = 13, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSourceClassCombinedWithDataSourceMethodTest", + fullyQualifiedName: "TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod.DataSourceClassCombinedWithDataSourceMethodTest", + filePath: "", + lineNumber: 13, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.One(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.CommonTestData.One()), }, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Two(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.CommonTestData.Two()), }, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Three(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.CommonTestData.Three()), }, }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.One(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.CommonTestData.One()), }, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Two(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.CommonTestData.Two()), }, new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Three(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.CommonTestData.Three()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt index 4f4a8b63c2..6e3ea16e51 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt @@ -132,87 +132,69 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "GeneratedData_Method", - FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GeneratedData_Method", + fullyQualifiedName: "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GeneratedData_Method2", - FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method2", - FilePath = "", - LineNumber = 18, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GeneratedData_Method2", + fullyQualifiedName: "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method2", + filePath: "", + lineNumber: 18, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GeneratedData_Method3", - FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method3", - FilePath = "", - LineNumber = 24, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GeneratedData_Method3", + fullyQualifiedName: "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method3", + filePath: "", + lineNumber: 24, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), }, - }, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt index baf2ca0a89..709d516430 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt @@ -74,28 +74,22 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value4", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.AutoDataTests.Test1", - FilePath = "", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.AutoDataTests.Test1", + filePath: "", + lineNumber: 7, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoDataAttribute(), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt index 44784f722a..59730ae3d4 100644 --- a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt @@ -335,276 +335,204 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "batchingSiz } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Transfer", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Transfer", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Transfer", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.Transfer", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2_000m, 123_999.00000000000000001m), new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m, 123_999m), new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m, 123_999.00000000000000001m), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "SimpleDecimal", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.SimpleDecimal", - FilePath = "", - LineNumber = 29, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SimpleDecimal", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.SimpleDecimal", + filePath: "", + lineNumber: 29, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123.456m), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "SmallDecimal", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.SmallDecimal", - FilePath = "", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SmallDecimal", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.SmallDecimal", + filePath: "", + lineNumber: 36, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0.00000000000000001m), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MaxDecimal", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MaxDecimal", - FilePath = "", - LineNumber = 43, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MaxDecimal", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.MaxDecimal", + filePath: "", + lineNumber: 43, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("79228162514264337593543950335"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MinDecimal", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MinDecimal", - FilePath = "", - LineNumber = 50, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MinDecimal", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.MinDecimal", + filePath: "", + lineNumber: 50, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("-79228162514264337593543950335"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ExplicitDecimalValue", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.ExplicitDecimalValue", - FilePath = "", - LineNumber = 57, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ExplicitDecimalValue", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.ExplicitDecimalValue", + filePath: "", + lineNumber: 57, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("123.456"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MultipleDecimals", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MultipleDecimals", - FilePath = "", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MultipleDecimals", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.MultipleDecimals", + filePath: "", + lineNumber: 64, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1m, 2.2m, 3.3m), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Test", - FilePath = "", - LineNumber = 73, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.Test", + filePath: "", + lineNumber: 73, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0.5m), new global::TUnit.Core.ArgumentsAttribute(0.75m), new global::TUnit.Core.ArgumentsAttribute(1m), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "TransactionDiscountCalculations", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.TransactionDiscountCalculations", - FilePath = "", - LineNumber = 82, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TransactionDiscountCalculations", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.TransactionDiscountCalculations", + filePath: "", + lineNumber: 82, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(50m, 75m, 70m, 5m, 0m, true), new global::TUnit.Core.ArgumentsAttribute(70m, 75m, 70m, 5m, 5m, true), new global::TUnit.Core.ArgumentsAttribute(70m, 75m, 70m, 5m, 0m, false), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Equality3", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Equality3", - FilePath = "", - LineNumber = 91, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Equality3", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.Equality3", + filePath: "", + lineNumber: 91, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Equality4", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Equality4", - FilePath = "", - LineNumber = 104, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Equality4", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.Equality4", + filePath: "", + lineNumber: 104, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123_999.00000000000000001m), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.TestMethod", - FilePath = "", - LineNumber = 119, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestMethod", + fullyQualifiedName: "TUnit.TestProject.DecimalArgumentTests.TestMethod", + filePath: "", + lineNumber: 119, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(42), }, - }, + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DeferEnumerationTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DeferEnumerationTests.Test.verified.txt index e741c62792..f49a053aa9 100644 --- a/TUnit.Core.SourceGenerator.Tests/DeferEnumerationTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DeferEnumerationTests.Test.verified.txt @@ -102,94 +102,47 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Deferred", - FullyQualifiedName = "TUnit.TestProject.DeferEnumerationTests.DeferEnumerationTests.Deferred", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Deferred", + fullyQualifiedName: "TUnit.TestProject.DeferEnumerationTests.DeferEnumerationTests.Deferred", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TenValues") { DeferEnumeration = true, - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.DeferEnumerationTests.DeferEnumerationTests.TenValues(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.DeferEnumerationTests.DeferEnumerationTests.TenValues()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DeferredWithRepeat", - FullyQualifiedName = "TUnit.TestProject.DeferEnumerationTests.DeferEnumerationTests.DeferredWithRepeat", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 2, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DeferredWithRepeat", + fullyQualifiedName: "TUnit.TestProject.DeferEnumerationTests.DeferEnumerationTests.DeferredWithRepeat", + filePath: "", + lineNumber: 16, + hasDataSource: true, + repeatCount: 2, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TenValues") { DeferEnumeration = true, - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.DeferEnumerationTests.DeferEnumerationTests.TenValues(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.DeferEnumerationTests.DeferEnumerationTests.TenValues()), }, }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 1), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt index 1cd352a4a2..cc79c6cee5 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt index 9eb50f03f6..7244dbbf04 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt @@ -85,60 +85,39 @@ internal static class TUnit_TestProject_BasicTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", - FilePath = "", - LineNumber = 5, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.SynchronousTest", + filePath: "", + lineNumber: 5, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.AsynchronousTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ValueTaskAsynchronousTest", + fullyQualifiedName: "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + filePath: "", + lineNumber: 17, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt index f957820e53..e1c0bbd486 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt @@ -73,30 +73,24 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SomeTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SomeTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("A"), new global::TUnit.Core.ArgumentsAttribute("B"), new global::TUnit.Core.ArgumentsAttribute("C"), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt index 65bd472b8e..1485a42d47 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt @@ -119,135 +119,63 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProj } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method2", + fullyQualifiedName: "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2", + filePath: "", + lineNumber: 15, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = "", - LineNumber = 22, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_WithBaseReturn", + fullyQualifiedName: "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn", + filePath: "", + lineNumber: 22, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.MethodWithBaseReturn(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.EnumerableDataSourceDrivenTests.MethodWithBaseReturn()), }, }, - }, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt index 5c03a9645d..95bbf148a9 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt @@ -75,71 +75,29 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_TupleMethod", - FullyQualifiedName = "TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_TupleMethod", + fullyQualifiedName: "TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.TupleMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.TupleMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.NamedTupleMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.NamedTupleMethod()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt index de258c754f..f13bfd91e0 100644 --- a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt @@ -98,24 +98,13 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "TypedArguments", - FullyQualifiedName = "TUnit.TestProject.ExpectedArgumentTypeTests.TypedArguments", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TypedArguments", + fullyQualifiedName: "TUnit.TestProject.ExpectedArgumentTypeTests.TypedArguments", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0d, typeof(double)), new global::TUnit.Core.ArgumentsAttribute(0f, typeof(float)), @@ -131,25 +120,19 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), new global::TUnit.Core.ArgumentsAttribute((ulong)0, typeof(ulong)), new global::TUnit.Core.ArgumentsAttribute(0UL, typeof(ulong)), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumTypes", - FullyQualifiedName = "TUnit.TestProject.ExpectedArgumentTypeTests.EnumTypes", - FilePath = "", - LineNumber = 25, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumTypes", + fullyQualifiedName: "TUnit.TestProject.ExpectedArgumentTypeTests.EnumTypes", + filePath: "", + lineNumber: 25, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.ByteEnum.Default, typeof(global::TUnit.TestProject.ByteEnum), typeof(byte)), new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.SByteEnum.Default, typeof(global::TUnit.TestProject.SByteEnum), typeof(sbyte)), @@ -160,7 +143,12 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int64Enum.Default, typeof(global::TUnit.TestProject.Int64Enum), typeof(long)), new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt64Enum.Default, typeof(global::TUnit.TestProject.UInt64Enum), typeof(ulong)), }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt index 66e453a89f..830db4f3f7 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt @@ -94,92 +94,44 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "expected", n } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "AggregateBy_HasExpectedOutput", - FullyQualifiedName = "TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AggregateBy_HasExpectedOutput", + fullyQualifiedName: "TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.GenericMethodTests.AggregateBy_Numeric_TestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.GenericMethodTests.AggregateBy_Numeric_TestData()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AggregateBy_HasExpectedOutput", - FullyQualifiedName = "TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 1, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AggregateBy_HasExpectedOutput", + fullyQualifiedName: "TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.GenericMethodTests.AggregateBy_String_TestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.GenericMethodTests.AggregateBy_String_TestData()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 1, + createAttributes: __Attributes_0, + attributeGroupIndex: 1), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/GenericMethodWithDataSourceTests.Generic_Method_With_MethodDataSource_Should_Generate_Tests.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericMethodWithDataSourceTests.Generic_Method_With_MethodDataSource_Should_Generate_Tests.verified.txt index 954a201ab6..a9cceca825 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericMethodWithDataSourceTests.Generic_Method_With_MethodDataSource_Should_Generate_Tests.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericMethodWithDataSourceTests.Generic_Method_With_MethodDataSource_Should_Generate_Tests.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Sh } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Create_Instance", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassNoDataSource.Should_Create_Instance", - FilePath = "", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Create_Instance", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassNoDataSource.Should_Create_Instance", + filePath: "", + lineNumber: 35, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -93,24 +86,17 @@ internal static class TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Sh } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Create_Instance", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassNoDataSource.Should_Create_Instance", - FilePath = "", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Create_Instance", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassNoDataSource.Should_Create_Instance", + filePath: "", + lineNumber: 35, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -178,49 +164,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "number", new gl } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Have_Number", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.Should_Have_Number", - FilePath = "", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Have_Number", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.Should_Have_Number", + filePath: "", + lineNumber: 59, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("GetNumbers") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.GetNumbers(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.GetNumbers()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -250,49 +212,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "number", new gl } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Have_Number", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.Should_Have_Number", - FilePath = "", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Have_Number", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.Should_Have_Number", + filePath: "", + lineNumber: 59, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("GetNumbers") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.GetNumbers(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.GetNumbers()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -417,60 +355,39 @@ internal static class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "GenericMethod_Should_Work", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", - FilePath = "", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericMethod_Should_Work", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", - FilePath = "", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 1, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 1, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericMethod_Should_Work", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", - FilePath = "", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 2, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 2, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericMethod_Should_Work", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", + filePath: "", + lineNumber: 74, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericMethod_Should_Work", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", + filePath: "", + lineNumber: 74, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 1, + createAttributes: __Attributes_0, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericMethod_Should_Work", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", + filePath: "", + lineNumber: 74, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 2, + createAttributes: __Attributes_0, + attributeGroupIndex: 2), }; } internal static partial class TUnit_TestRegistration @@ -572,92 +489,44 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "GenericMethod_With_DataSource", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GenericMethod_With_DataSource", - FilePath = "", - LineNumber = 97, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericMethod_With_DataSource", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GenericMethod_With_DataSource", + filePath: "", + lineNumber: 97, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GetStrings(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GetStrings()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericMethod_With_DataSource", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GenericMethod_With_DataSource", - FilePath = "", - LineNumber = 97, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 1, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericMethod_With_DataSource", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GenericMethod_With_DataSource", + filePath: "", + lineNumber: 97, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GetStrings(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GetStrings()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 1, + createAttributes: __Attributes_0, + attributeGroupIndex: 1), }; } internal static partial class TUnit_TestRegistration @@ -758,42 +627,28 @@ internal static class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "BothGeneric_Should_Work", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", - FilePath = "", - LineNumber = 117, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry> - { - MethodName = "BothGeneric_Should_Work", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", - FilePath = "", - LineNumber = 117, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 1, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 1, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "BothGeneric_Should_Work", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", + filePath: "", + lineNumber: 117, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "BothGeneric_Should_Work", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", + filePath: "", + lineNumber: 117, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 1, + createAttributes: __Attributes_0, + attributeGroupIndex: 1), }; private static global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -863,42 +718,28 @@ internal static class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "BothGeneric_Should_Work", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", - FilePath = "", - LineNumber = 117, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry> - { - MethodName = "BothGeneric_Should_Work", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", - FilePath = "", - LineNumber = 117, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 1, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 1, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "BothGeneric_Should_Work", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", + filePath: "", + lineNumber: 117, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "BothGeneric_Should_Work", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", + filePath: "", + lineNumber: 117, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 1, + createAttributes: __Attributes_1, + attributeGroupIndex: 1), }; } internal static partial class TUnit_TestRegistration @@ -962,24 +803,17 @@ internal static class TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Have_Label", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithConstructor.Should_Have_Label", - FilePath = "", - LineNumber = 144, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Have_Label", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithConstructor.Should_Have_Label", + filePath: "", + lineNumber: 144, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -1008,24 +842,17 @@ internal static class TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Have_Label", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithConstructor.Should_Have_Label", - FilePath = "", - LineNumber = 144, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Have_Label", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithConstructor.Should_Have_Label", + filePath: "", + lineNumber: 144, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -1089,24 +916,17 @@ internal static class TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_ } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Handle_Multiple_Type_Parameters", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.MultipleTypeParameters.Should_Handle_Multiple_Type_Parameters", - FilePath = "", - LineNumber = 160, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Handle_Multiple_Type_Parameters", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.MultipleTypeParameters.Should_Handle_Multiple_Type_Parameters", + filePath: "", + lineNumber: 160, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -1135,24 +955,17 @@ internal static class TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_ } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Handle_Multiple_Type_Parameters", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.MultipleTypeParameters.Should_Handle_Multiple_Type_Parameters", - FilePath = "", - LineNumber = 160, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Handle_Multiple_Type_Parameters", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.MultipleTypeParameters.Should_Handle_Multiple_Type_Parameters", + filePath: "", + lineNumber: 160, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -1216,24 +1029,17 @@ internal static class TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_ } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Create_From_Base", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.DerivedGenericClass.Should_Create_From_Base", - FilePath = "", - LineNumber = 184, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Create_From_Base", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.DerivedGenericClass.Should_Create_From_Base", + filePath: "", + lineNumber: 184, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.Bugs._4431.DerivedGenericClass __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -1262,24 +1068,17 @@ internal static class TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_ } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Create_From_Base", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.DerivedGenericClass.Should_Create_From_Base", - FilePath = "", - LineNumber = 184, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Create_From_Base", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.DerivedGenericClass.Should_Create_From_Base", + filePath: "", + lineNumber: 184, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -1356,24 +1155,17 @@ internal static class TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSour } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Have_DataSource", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource.Should_Have_DataSource", - FilePath = "", - LineNumber = 210, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Have_DataSource", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource.Should_Have_DataSource", + filePath: "", + lineNumber: 210, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -1402,24 +1194,17 @@ internal static class TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSour } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "Should_Have_DataSource", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource.Should_Have_DataSource", - FilePath = "", - LineNumber = 210, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "Should_Have_DataSource", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource.Should_Have_DataSource", + filePath: "", + lineNumber: 210, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -1542,92 +1327,44 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new glo } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "FullyGeneric_With_DataSources", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", - FilePath = "", - LineNumber = 236, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "FullyGeneric_With_DataSources", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", + filePath: "", + lineNumber: 236, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans()), }, }, - }, - new global::TUnit.Core.TestEntry> - { - MethodName = "FullyGeneric_With_DataSources", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", - FilePath = "", - LineNumber = 236, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 1, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "FullyGeneric_With_DataSources", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", + filePath: "", + lineNumber: 236, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 1, + createAttributes: __Attributes_0, + attributeGroupIndex: 1), }; private static global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -1699,92 +1436,44 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new glo } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "FullyGeneric_With_DataSources", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", - FilePath = "", - LineNumber = 236, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "FullyGeneric_With_DataSources", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", + filePath: "", + lineNumber: 236, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans()), }, }, - }, - new global::TUnit.Core.TestEntry> - { - MethodName = "FullyGeneric_With_DataSources", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", - FilePath = "", - LineNumber = 236, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 1, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "FullyGeneric_With_DataSources", + fullyQualifiedName: "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", + filePath: "", + lineNumber: 236, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 1, + createAttributes: __Attributes_1, + attributeGroupIndex: 1), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt index 8b4aafd948..fca53b8f90 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt @@ -61,24 +61,17 @@ internal static class TUnit_TestProject_SimpleTestClass__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "NonGenericTest", - FullyQualifiedName = "TUnit.TestProject.SimpleTestClass.NonGenericTest", - FilePath = "", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonGenericTest", + fullyQualifiedName: "TUnit.TestProject.SimpleTestClass.NonGenericTest", + filePath: "", + lineNumber: 7, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt index 7bbc280105..e81bd87d3e 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.ConstrainedGenericTestClass.TestMethod", - FilePath = "", - LineNumber = 10, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "TestMethod", + fullyQualifiedName: "TUnit.TestProject.ConstrainedGenericTestClass.TestMethod", + filePath: "", + lineNumber: 10, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.ConstrainedGenericTestClass __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -93,24 +86,17 @@ internal static class TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.ConstrainedGenericTestClass.TestMethod", - FilePath = "", - LineNumber = 10, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "TestMethod", + fullyQualifiedName: "TUnit.TestProject.ConstrainedGenericTestClass.TestMethod", + filePath: "", + lineNumber: 10, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt index 3073d85faa..ab64b6f2a0 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.GenericTestClass.TestMethod", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "TestMethod", + fullyQualifiedName: "TUnit.TestProject.GenericTestClass.TestMethod", + filePath: "", + lineNumber: 9, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.GenericTestClass __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -93,24 +86,17 @@ internal static class TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.GenericTestClass.TestMethod", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "TestMethod", + fullyQualifiedName: "TUnit.TestProject.GenericTestClass.TestMethod", + filePath: "", + lineNumber: 9, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt index 0b919f6eaa..1fdc26e606 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt @@ -84,42 +84,28 @@ internal static class TUnit_TestProject_TestClass_GenericTestMethod_TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "GenericTestMethod", - FullyQualifiedName = "TUnit.TestProject.TestClass.GenericTestMethod", - FilePath = "", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericTestMethod", - FullyQualifiedName = "TUnit.TestProject.TestClass.GenericTestMethod", - FilePath = "", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 1, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 1, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericTestMethod", + fullyQualifiedName: "TUnit.TestProject.TestClass.GenericTestMethod", + filePath: "", + lineNumber: 7, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericTestMethod", + fullyQualifiedName: "TUnit.TestProject.TestClass.GenericTestMethod", + filePath: "", + lineNumber: 7, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 1, + createAttributes: __Attributes_0, + attributeGroupIndex: 1), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt index ada8cac096..81fe98465b 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_T } public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.MultiGenericTestClass.TestMethod", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "TestMethod", + fullyQualifiedName: "TUnit.TestProject.MultiGenericTestClass.TestMethod", + filePath: "", + lineNumber: 9, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.MultiGenericTestClass __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -93,24 +86,17 @@ internal static class TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_T } public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - new global::TUnit.Core.TestEntry> - { - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.MultiGenericTestClass.TestMethod", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>( + methodName: "TestMethod", + fullyQualifiedName: "TUnit.TestProject.MultiGenericTestClass.TestMethod", + filePath: "", + lineNumber: 9, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt index 91b37164e3..4f70745f63 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_NestedGenericTestClass_T_TestMethod_Test } public static readonly global::TUnit.Core.TestEntry>>[] Entries_0 = new global::TUnit.Core.TestEntry>>[] { - new global::TUnit.Core.TestEntry>> - { - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.NestedGenericTestClass>.TestMethod", - FilePath = "", - LineNumber = 10, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>>( + methodName: "TestMethod", + fullyQualifiedName: "TUnit.TestProject.NestedGenericTestClass>.TestMethod", + filePath: "", + lineNumber: 10, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; private static global::TUnit.TestProject.NestedGenericTestClass> __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) { @@ -93,24 +86,17 @@ internal static class TUnit_TestProject_NestedGenericTestClass_T_TestMethod_Test } public static readonly global::TUnit.Core.TestEntry>>[] Entries_1 = new global::TUnit.Core.TestEntry>>[] { - new global::TUnit.Core.TestEntry>> - { - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.NestedGenericTestClass>.TestMethod", - FilePath = "", - LineNumber = 10, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_1, - InvokeBody = __Invoke_1, - MethodIndex = 0, - CreateAttributes = __Attributes_1, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create>>( + methodName: "TestMethod", + fullyQualifiedName: "TUnit.TestProject.NestedGenericTestClass>.TestMethod", + filePath: "", + lineNumber: 10, + methodMetadata: __mm_0, + createInstance: __CreateInstance_1, + invokeBody: __Invoke_1, + methodIndex: 0, + createAttributes: __Attributes_1, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt index 426acfb484..eaf217b31f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt @@ -66,29 +66,23 @@ internal static class TUnit_TestProject_Bugs__1589_MyTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1589.MyTests.Test1", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._1589.MyTests.Test1", + filePath: "", + lineNumber: 15, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() {Shared = global::TUnit.Core.SharedType.None,}, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt index cd30d1344b..d72ae86af4 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt @@ -67,29 +67,23 @@ internal static class TUnit_TestProject_Bugs__1594_MyTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1594.MyTests.Test1", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._1594.MyTests.Test1", + filePath: "", + lineNumber: 15, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() {Shared = global::TUnit.Core.SharedType.None,}, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt index cf1a2ca12c..99ee7f6758 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt @@ -175,24 +175,17 @@ internal static class TUnit_TestProject_PropertySetterTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.PropertySetterTests.Test", - FilePath = "", - LineNumber = 69, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.PropertySetterTests.Test", + filePath: "", + lineNumber: 69, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -261,24 +254,17 @@ internal static class TUnit_TestProject_InheritedPropertySetterTests_Test_TestSo } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.InheritedPropertySetterTests.Test", - FilePath = "", - LineNumber = 70, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.InheritedPropertySetterTests.Test", + filePath: "", + lineNumber: 70, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt index 7628a25aef..09e2a13aad 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt @@ -124,108 +124,66 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericMethodDataSource", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.GenericMethodDataSource", - FilePath = "", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test", + filePath: "", + lineNumber: 9, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericMethodDataSource", + fullyQualifiedName: "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.GenericMethodDataSource", + filePath: "", + lineNumber: 14, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("Foo") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TestData.Foo(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.TestData.Foo()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "NonGenericMethodDataSource", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource", - FilePath = "", - LineNumber = 20, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NonGenericMethodDataSource", + fullyQualifiedName: "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource", + filePath: "", + lineNumber: 20, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.TestData), "Foo") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TestData.Foo(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.TestData.Foo()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "VerifyInheritedCategoriesAreAvailable", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.VerifyInheritedCategoriesAreAvailable", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "VerifyInheritedCategoriesAreAvailable", + fullyQualifiedName: "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.VerifyInheritedCategoriesAreAvailable", + filePath: "", + lineNumber: 26, + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -287,24 +245,18 @@ internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "BaseTest", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTest", - FilePath = "", - LineNumber = 8, - Categories = new string[] { "BaseCategory" }, - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "BaseTest", + fullyQualifiedName: "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTest", + filePath: "", + lineNumber: 8, + categories: new string[] { "BaseCategory" }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -367,24 +319,18 @@ internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "BaseTestWithMultipleCategories", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTestWithMultipleCategories", - FilePath = "", - LineNumber = 15, - Categories = new string[] { "AnotherBaseCategory", "MultipleCategories" }, - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "BaseTestWithMultipleCategories", + fullyQualifiedName: "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTestWithMultipleCategories", + filePath: "", + lineNumber: 15, + categories: new string[] { "AnotherBaseCategory", "MultipleCategories" }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt index 2012faaff0..1dd47d15bd 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt @@ -63,24 +63,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "SecondTest", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SecondTest", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", + filePath: "", + lineNumber: 11, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -139,24 +132,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "AssertClassName", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AssertClassName", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -214,24 +200,17 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "AssertClassName", - FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AssertClassName", + fullyQualifiedName: "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt index 9a6d62d5f4..84b60386bc 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt @@ -93,30 +93,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.BaseClass.Test", - FilePath = "", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 10, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.Bugs._1924.None.BaseClass.Test", + filePath: "", + lineNumber: 11, + hasDataSource: true, + repeatCount: 10, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -193,30 +188,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.Tests.Test", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 10, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.Bugs._1924.None.Tests.Test", + filePath: "", + lineNumber: 16, + hasDataSource: true, + repeatCount: 10, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -293,30 +283,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.Tests2.Test", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 10, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.Bugs._1924.None.Tests2.Test", + filePath: "", + lineNumber: 16, + hasDataSource: true, + repeatCount: 10, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -393,30 +378,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new glo } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.Tests3.Test", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 10, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.Bugs._1924.None.Tests3.Test", + filePath: "", + lineNumber: 16, + hasDataSource: true, + repeatCount: 10, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), new global::TUnit.Core.ArgumentsAttribute(2), new global::TUnit.Core.ArgumentsAttribute(3), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt index 774ff9a8bb..8ff28bfc11 100644 --- a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt @@ -66,24 +66,17 @@ internal static class TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSou } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._Issue2887.ActualTestClass.Test1", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._Issue2887.ActualTestClass.Test1", + filePath: "", + lineNumber: 26, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt index ce7adbc402..4e9950a109 100644 --- a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt @@ -372,292 +372,214 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProj } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_One", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_One", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Two", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Two", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = "", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest_Enum", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + filePath: "", + lineNumber: 30, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = "", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools", + filePath: "", + lineNumber: 40, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = "", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "AutoGenerateBools2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + filePath: "", + lineNumber: 49, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = "", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ImplicitConversion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ImplicitConversion", + filePath: "", + lineNumber: 58, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = "", - LineNumber = 67, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ExcludingAutoGeneratedMatrixValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + filePath: "", + lineNumber: 67, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = "", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method1", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method1", + filePath: "", + lineNumber: 116, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", - FilePath = "", - LineNumber = 124, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method2", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method2", + filePath: "", + lineNumber: 124, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = "", - LineNumber = 132, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method3", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method3", + filePath: "", + lineNumber: 132, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = "", - LineNumber = 140, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Method4", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Method4", + filePath: "", + lineNumber: 140, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = "", - LineNumber = 148, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Exclusion", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.Exclusion", + filePath: "", + lineNumber: 148, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = "", - LineNumber = 197, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_12, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 12, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + fullyQualifiedName: "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + filePath: "", + lineNumber: 197, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_12, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 12, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt index f6709b10a7..e825a6dceb 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt @@ -240,304 +240,158 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method2", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method_WithAction", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = "", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method3", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + filePath: "", + lineNumber: 33, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_Method4", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + filePath: "", + lineNumber: 42, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = "", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_WithBaseReturn", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + filePath: "", + lineNumber: 53, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = "", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "EnumerableFuncArrayTest", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + filePath: "", + lineNumber: 59, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData()), }, }, - }, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt index 3b3c56b23d..499e1e87c0 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt @@ -75,139 +75,45 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threadi } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "MyTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MyTest", + fullyQualifiedName: "TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("T") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.T(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.T()), }, new global::TUnit.Core.MethodDataSourceAttribute("FuncT") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.FuncT(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.FuncT()), }, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableT()), }, new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableFuncT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableFuncT()), }, new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayT()), }, new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayFuncT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayFuncT()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt index 68d16d488b..2126f5a223 100644 --- a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt @@ -84,52 +84,40 @@ internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests__Test } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test1", - FilePath = "", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test1", + filePath: "", + lineNumber: 17, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() {Shared = new global::TUnit.Core.SharedType[]{global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None},}, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test2", - FilePath = "", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test2", + filePath: "", + lineNumber: 23, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() {Shared = new global::TUnit.Core.SharedType[]{global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None},}, }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt index b121e2c326..653b19c182 100644 --- a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt @@ -72,28 +72,22 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "name", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "TestName", - FullyQualifiedName = "TUnit.TestProject.NameOfArgumentTests.TestName", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestName", + fullyQualifiedName: "TUnit.TestProject.NameOfArgumentTests.TestName", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("TestName"), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt index bd328607d6..dbea76f73e 100644 --- a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt @@ -98,52 +98,40 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte?), "byte2", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.NullableByteArgumentTests.Test", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.NullableByteArgumentTests.Test", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute((byte) 1), new global::TUnit.Core.ArgumentsAttribute(null), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.NullableByteArgumentTests.Test2", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.NullableByteArgumentTests.Test2", + filePath: "", + lineNumber: 15, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute((byte) 1, (byte) 1), new global::TUnit.Core.ArgumentsAttribute((byte) 1, null), }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt index d03041d9dd..61ce4ca217 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt @@ -193,138 +193,102 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "i", new global } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Int", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Int", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Int", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.Int", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Double", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Double", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Double", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.Double", + filePath: "", + lineNumber: 15, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Float", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Float", - FilePath = "", - LineNumber = 22, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Float", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.Float", + filePath: "", + lineNumber: 22, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1f), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Long", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Long", - FilePath = "", - LineNumber = 29, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Long", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.Long", + filePath: "", + lineNumber: 29, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1L), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ULong", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.ULong", - FilePath = "", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ULong", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.ULong", + filePath: "", + lineNumber: 36, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1UL), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "UInt", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.UInt", - FilePath = "", - LineNumber = 43, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "UInt", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.UInt", + filePath: "", + lineNumber: 43, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1U), }, - }, + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt index d03041d9dd..61ce4ca217 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt @@ -193,138 +193,102 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "i", new global } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Int", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Int", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Int", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.Int", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Double", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Double", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Double", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.Double", + filePath: "", + lineNumber: 15, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Float", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Float", - FilePath = "", - LineNumber = 22, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Float", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.Float", + filePath: "", + lineNumber: 22, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1f), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Long", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Long", - FilePath = "", - LineNumber = 29, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Long", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.Long", + filePath: "", + lineNumber: 29, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1L), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "ULong", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.ULong", - FilePath = "", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "ULong", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.ULong", + filePath: "", + lineNumber: 36, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1UL), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "UInt", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.UInt", - FilePath = "", - LineNumber = 43, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "UInt", + fullyQualifiedName: "TUnit.TestProject.NumberArgumentTests.UInt", + filePath: "", + lineNumber: 43, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1U), }, - }, + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt index 86ed6cd9d8..dd6811219f 100644 --- a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt @@ -137,114 +137,72 @@ internal static class TUnit_TestProject_PriorityFilteringTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "High_1", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_1", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "High_2", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_2", - FilePath = "", - LineNumber = 18, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "High_3", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_3", - FilePath = "", - LineNumber = 24, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Medium_1", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Medium_1", - FilePath = "", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Medium_2", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Medium_2", - FilePath = "", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Low_1", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Low_1", - FilePath = "", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 2, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "High_1", + fullyQualifiedName: "TUnit.TestProject.PriorityFilteringTests.High_1", + filePath: "", + lineNumber: 12, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "High_2", + fullyQualifiedName: "TUnit.TestProject.PriorityFilteringTests.High_2", + filePath: "", + lineNumber: 18, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "High_3", + fullyQualifiedName: "TUnit.TestProject.PriorityFilteringTests.High_3", + filePath: "", + lineNumber: 24, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Medium_1", + fullyQualifiedName: "TUnit.TestProject.PriorityFilteringTests.Medium_1", + filePath: "", + lineNumber: 30, + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Medium_2", + fullyQualifiedName: "TUnit.TestProject.PriorityFilteringTests.Medium_2", + filePath: "", + lineNumber: 36, + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Low_1", + fullyQualifiedName: "TUnit.TestProject.PriorityFilteringTests.Low_1", + filePath: "", + lineNumber: 42, + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 2), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt index 44a032d10e..084f144d45 100644 --- a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt @@ -175,24 +175,17 @@ internal static class TUnit_TestProject_PropertySetterTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.PropertySetterTests.Test", - FilePath = "", - LineNumber = 69, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.PropertySetterTests.Test", + filePath: "", + lineNumber: 69, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt index 4467e6ba33..f02be063a1 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt @@ -84,42 +84,30 @@ internal static class TUnit_TestProject_AssemblyRepeatTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "TestWithAssemblyRepeat", - FullyQualifiedName = "TUnit.TestProject.AssemblyRepeatTests.TestWithAssemblyRepeat", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 3, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "TestWithMethodRepeatOverride", - FullyQualifiedName = "TUnit.TestProject.AssemblyRepeatTests.TestWithMethodRepeatOverride", - FilePath = "", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 1, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestWithAssemblyRepeat", + fullyQualifiedName: "TUnit.TestProject.AssemblyRepeatTests.TestWithAssemblyRepeat", + filePath: "", + lineNumber: 9, + repeatCount: 3, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestWithMethodRepeatOverride", + fullyQualifiedName: "TUnit.TestProject.AssemblyRepeatTests.TestWithMethodRepeatOverride", + filePath: "", + lineNumber: 14, + repeatCount: 1, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 1), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt index 0a97fc7451..016d3deb36 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt @@ -109,60 +109,42 @@ internal static class TUnit_TestProject_RepeatTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "One", - FullyQualifiedName = "TUnit.TestProject.RepeatTests.One", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 1, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Two", - FullyQualifiedName = "TUnit.TestProject.RepeatTests.Two", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 2, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Three", - FullyQualifiedName = "TUnit.TestProject.RepeatTests.Three", - FilePath = "", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 3, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 2, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "One", + fullyQualifiedName: "TUnit.TestProject.RepeatTests.One", + filePath: "", + lineNumber: 9, + repeatCount: 1, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Two", + fullyQualifiedName: "TUnit.TestProject.RepeatTests.Two", + filePath: "", + lineNumber: 16, + repeatCount: 2, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Three", + fullyQualifiedName: "TUnit.TestProject.RepeatTests.Three", + filePath: "", + lineNumber: 23, + repeatCount: 3, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 2), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt index 1c89538718..d840b050ae 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt @@ -242,276 +242,186 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "With_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", - FilePath = "", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Without_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", - FilePath = "", - LineNumber = 20, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithSimpleAwait", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskYield", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - FilePath = "", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithConfigureAwaitTrue", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - FilePath = "", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithNestedAsyncCalls", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - FilePath = "", - LineNumber = 54, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskFromResult", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - FilePath = "", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithCompletedTask", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - FilePath = "", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskRun", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - FilePath = "", - LineNumber = 83, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithMultipleAwaits", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - FilePath = "", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithAsyncEnumerable", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - FilePath = "", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskWhenAll", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - FilePath = "", - LineNumber = 130, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithExceptionHandling", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - FilePath = "", - LineNumber = 147, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_12, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 12, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithThrowsNothingAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - FilePath = "", - LineNumber = 194, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_13, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 13, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithFuncAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - FilePath = "", - LineNumber = 211, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_14, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 14, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "With_STA", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.With_STA", + filePath: "", + lineNumber: 14, + repeatCount: 100, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Without_STA", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.Without_STA", + filePath: "", + lineNumber: 20, + repeatCount: 100, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithSimpleAwait", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + filePath: "", + lineNumber: 26, + repeatCount: 100, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskYield", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + filePath: "", + lineNumber: 36, + repeatCount: 100, + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithConfigureAwaitTrue", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + filePath: "", + lineNumber: 45, + repeatCount: 100, + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithNestedAsyncCalls", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + filePath: "", + lineNumber: 54, + repeatCount: 100, + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskFromResult", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + filePath: "", + lineNumber: 64, + repeatCount: 100, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithCompletedTask", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + filePath: "", + lineNumber: 74, + repeatCount: 100, + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskRun", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + filePath: "", + lineNumber: 83, + repeatCount: 100, + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithMultipleAwaits", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + filePath: "", + lineNumber: 98, + repeatCount: 100, + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithAsyncEnumerable", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + filePath: "", + lineNumber: 116, + repeatCount: 100, + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskWhenAll", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + filePath: "", + lineNumber: 130, + repeatCount: 100, + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithExceptionHandling", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + filePath: "", + lineNumber: 147, + repeatCount: 100, + methodMetadata: __mm_12, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 12, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithThrowsNothingAssertion", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + filePath: "", + lineNumber: 194, + repeatCount: 100, + methodMetadata: __mm_13, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 13, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithFuncAssertion", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + filePath: "", + lineNumber: 211, + repeatCount: 100, + methodMetadata: __mm_14, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 14, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt index 1c89538718..d840b050ae 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt @@ -242,276 +242,186 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "With_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", - FilePath = "", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Without_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", - FilePath = "", - LineNumber = 20, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithSimpleAwait", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskYield", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - FilePath = "", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithConfigureAwaitTrue", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - FilePath = "", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithNestedAsyncCalls", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - FilePath = "", - LineNumber = 54, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskFromResult", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - FilePath = "", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithCompletedTask", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - FilePath = "", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskRun", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - FilePath = "", - LineNumber = 83, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithMultipleAwaits", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - FilePath = "", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithAsyncEnumerable", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - FilePath = "", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskWhenAll", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - FilePath = "", - LineNumber = 130, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithExceptionHandling", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - FilePath = "", - LineNumber = 147, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_12, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 12, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithThrowsNothingAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - FilePath = "", - LineNumber = 194, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_13, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 13, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithFuncAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - FilePath = "", - LineNumber = 211, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_14, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 14, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "With_STA", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.With_STA", + filePath: "", + lineNumber: 14, + repeatCount: 100, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Without_STA", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.Without_STA", + filePath: "", + lineNumber: 20, + repeatCount: 100, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithSimpleAwait", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + filePath: "", + lineNumber: 26, + repeatCount: 100, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskYield", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + filePath: "", + lineNumber: 36, + repeatCount: 100, + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithConfigureAwaitTrue", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + filePath: "", + lineNumber: 45, + repeatCount: 100, + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithNestedAsyncCalls", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + filePath: "", + lineNumber: 54, + repeatCount: 100, + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskFromResult", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + filePath: "", + lineNumber: 64, + repeatCount: 100, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithCompletedTask", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + filePath: "", + lineNumber: 74, + repeatCount: 100, + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskRun", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + filePath: "", + lineNumber: 83, + repeatCount: 100, + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithMultipleAwaits", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + filePath: "", + lineNumber: 98, + repeatCount: 100, + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithAsyncEnumerable", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + filePath: "", + lineNumber: 116, + repeatCount: 100, + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskWhenAll", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + filePath: "", + lineNumber: 130, + repeatCount: 100, + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithExceptionHandling", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + filePath: "", + lineNumber: 147, + repeatCount: 100, + methodMetadata: __mm_12, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 12, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithThrowsNothingAssertion", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + filePath: "", + lineNumber: 194, + repeatCount: 100, + methodMetadata: __mm_13, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 13, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithFuncAssertion", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + filePath: "", + lineNumber: 211, + repeatCount: 100, + methodMetadata: __mm_14, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 14, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt index 1c89538718..d840b050ae 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt @@ -242,276 +242,186 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "With_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", - FilePath = "", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Without_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", - FilePath = "", - LineNumber = 20, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithSimpleAwait", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskYield", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - FilePath = "", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithConfigureAwaitTrue", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - FilePath = "", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithNestedAsyncCalls", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - FilePath = "", - LineNumber = 54, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskFromResult", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - FilePath = "", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithCompletedTask", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - FilePath = "", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskRun", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - FilePath = "", - LineNumber = 83, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithMultipleAwaits", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - FilePath = "", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithAsyncEnumerable", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - FilePath = "", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskWhenAll", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - FilePath = "", - LineNumber = 130, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithExceptionHandling", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - FilePath = "", - LineNumber = 147, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_12, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 12, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithThrowsNothingAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - FilePath = "", - LineNumber = 194, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_13, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 13, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithFuncAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - FilePath = "", - LineNumber = 211, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_14, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 14, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "With_STA", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.With_STA", + filePath: "", + lineNumber: 14, + repeatCount: 100, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Without_STA", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.Without_STA", + filePath: "", + lineNumber: 20, + repeatCount: 100, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithSimpleAwait", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + filePath: "", + lineNumber: 26, + repeatCount: 100, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskYield", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + filePath: "", + lineNumber: 36, + repeatCount: 100, + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithConfigureAwaitTrue", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + filePath: "", + lineNumber: 45, + repeatCount: 100, + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithNestedAsyncCalls", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + filePath: "", + lineNumber: 54, + repeatCount: 100, + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskFromResult", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + filePath: "", + lineNumber: 64, + repeatCount: 100, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithCompletedTask", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + filePath: "", + lineNumber: 74, + repeatCount: 100, + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskRun", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + filePath: "", + lineNumber: 83, + repeatCount: 100, + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithMultipleAwaits", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + filePath: "", + lineNumber: 98, + repeatCount: 100, + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithAsyncEnumerable", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + filePath: "", + lineNumber: 116, + repeatCount: 100, + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskWhenAll", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + filePath: "", + lineNumber: 130, + repeatCount: 100, + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithExceptionHandling", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + filePath: "", + lineNumber: 147, + repeatCount: 100, + methodMetadata: __mm_12, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 12, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithThrowsNothingAssertion", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + filePath: "", + lineNumber: 194, + repeatCount: 100, + methodMetadata: __mm_13, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 13, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithFuncAssertion", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + filePath: "", + lineNumber: 211, + repeatCount: 100, + methodMetadata: __mm_14, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 14, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt index 5ca79e92c0..f3c2f92b3a 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt @@ -242,276 +242,186 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "With_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", - FilePath = "", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Without_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", - FilePath = "", - LineNumber = 20, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithSimpleAwait", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskYield", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - FilePath = "", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithConfigureAwaitTrue", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - FilePath = "", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithNestedAsyncCalls", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - FilePath = "", - LineNumber = 54, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskFromResult", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - FilePath = "", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_6, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 6, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithCompletedTask", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - FilePath = "", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_7, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 7, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskRun", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - FilePath = "", - LineNumber = 83, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_8, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 8, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithMultipleAwaits", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - FilePath = "", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_9, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 9, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithAsyncEnumerable", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - FilePath = "", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_10, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 10, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithTaskWhenAll", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - FilePath = "", - LineNumber = 130, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_11, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 11, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithExceptionHandling", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - FilePath = "", - LineNumber = 147, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_12, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 12, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithThrowsNothingAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - FilePath = "", - LineNumber = 194, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_13, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 13, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "STA_WithFuncAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - FilePath = "", - LineNumber = 211, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_14, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 14, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "With_STA", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.With_STA", + filePath: "", + lineNumber: 14, + repeatCount: 100, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Without_STA", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.Without_STA", + filePath: "", + lineNumber: 20, + repeatCount: 100, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithSimpleAwait", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + filePath: "", + lineNumber: 26, + repeatCount: 100, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskYield", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + filePath: "", + lineNumber: 36, + repeatCount: 100, + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithConfigureAwaitTrue", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + filePath: "", + lineNumber: 45, + repeatCount: 100, + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithNestedAsyncCalls", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + filePath: "", + lineNumber: 54, + repeatCount: 100, + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskFromResult", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + filePath: "", + lineNumber: 64, + repeatCount: 100, + methodMetadata: __mm_6, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 6, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithCompletedTask", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + filePath: "", + lineNumber: 74, + repeatCount: 100, + methodMetadata: __mm_7, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 7, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskRun", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + filePath: "", + lineNumber: 83, + repeatCount: 100, + methodMetadata: __mm_8, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 8, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithMultipleAwaits", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + filePath: "", + lineNumber: 98, + repeatCount: 100, + methodMetadata: __mm_9, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 9, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithAsyncEnumerable", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + filePath: "", + lineNumber: 116, + repeatCount: 100, + methodMetadata: __mm_10, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 10, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithTaskWhenAll", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + filePath: "", + lineNumber: 130, + repeatCount: 100, + methodMetadata: __mm_11, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 11, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithExceptionHandling", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + filePath: "", + lineNumber: 147, + repeatCount: 100, + methodMetadata: __mm_12, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 12, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithThrowsNothingAssertion", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + filePath: "", + lineNumber: 194, + repeatCount: 100, + methodMetadata: __mm_13, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 13, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "STA_WithFuncAssertion", + fullyQualifiedName: "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + filePath: "", + lineNumber: 211, + repeatCount: 100, + methodMetadata: __mm_14, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 14, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt index 1c8c47a545..c6a02444c7 100644 --- a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt @@ -97,24 +97,13 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "s", new glob } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Normal", - FullyQualifiedName = "TUnit.TestProject.StringArgumentTests.Normal", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Normal", + fullyQualifiedName: "TUnit.TestProject.StringArgumentTests.Normal", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), new global::TUnit.Core.ArgumentsAttribute(@"\"), @@ -129,25 +118,19 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "s", new glob """ ), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Nullable", - FullyQualifiedName = "TUnit.TestProject.StringArgumentTests.Nullable", - FilePath = "", - LineNumber = 27, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Nullable", + fullyQualifiedName: "TUnit.TestProject.StringArgumentTests.Nullable", + filePath: "", + lineNumber: 27, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), new global::TUnit.Core.ArgumentsAttribute(@"\"), @@ -158,7 +141,12 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "s", new glob new global::TUnit.Core.ArgumentsAttribute("\\\\t"), new global::TUnit.Core.ArgumentsAttribute(null), }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt index ad605228bf..44cfa456cd 100644 --- a/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt @@ -61,24 +61,17 @@ internal static class TUnit_TestProject_TestDiscoveryHookTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "CustomNamedDiscoveryHooksWereRegisteredAndRan", - FullyQualifiedName = "TUnit.TestProject.TestDiscoveryHookTests.CustomNamedDiscoveryHooksWereRegisteredAndRan", - FilePath = "", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "CustomNamedDiscoveryHooksWereRegisteredAndRan", + fullyQualifiedName: "TUnit.TestProject.TestDiscoveryHookTests.CustomNamedDiscoveryHooksWereRegisteredAndRan", + filePath: "", + lineNumber: 35, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt index f0aa1b4227..d298ee0892 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt @@ -120,24 +120,13 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "TryParse_InvalidString_ReturnsFailure", - FullyQualifiedName = "TUnit.TestProject.Bugs._1304.Tests.TryParse_InvalidString_ReturnsFailure", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TryParse_InvalidString_ReturnsFailure", + fullyQualifiedName: "TUnit.TestProject.Bugs._1304.Tests.TryParse_InvalidString_ReturnsFailure", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), new global::TUnit.Core.ArgumentsAttribute("invalidNotAGui"), @@ -145,25 +134,19 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new new global::TUnit.Core.ArgumentsAttribute(" "), new global::TUnit.Core.ArgumentsAttribute(null), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Parse_InvalidString_ThrowsException", - FullyQualifiedName = "TUnit.TestProject.Bugs._1304.Tests.Parse_InvalidString_ThrowsException", - FilePath = "", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Parse_InvalidString_ThrowsException", + fullyQualifiedName: "TUnit.TestProject.Bugs._1304.Tests.Parse_InvalidString_ThrowsException", + filePath: "", + lineNumber: 26, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), new global::TUnit.Core.ArgumentsAttribute("invalidNotAGui"), @@ -171,30 +154,29 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new new global::TUnit.Core.ArgumentsAttribute(" "), new global::TUnit.Core.ArgumentsAttribute(null), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "TryParse_ValidString_ReturnsAccountId", - FullyQualifiedName = "TUnit.TestProject.Bugs._1304.Tests.TryParse_ValidString_ReturnsAccountId", - FilePath = "", - LineNumber = 38, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TryParse_ValidString_ReturnsAccountId", + fullyQualifiedName: "TUnit.TestProject.Bugs._1304.Tests.TryParse_ValidString_ReturnsAccountId", + filePath: "", + lineNumber: 38, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("2c48c152-7cb7-4f51-8f01-704454f36e60"), new global::TUnit.Core.ArgumentsAttribute("00000000-0000-0000-0000-000000000000"), }, - }, + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt index c38e9fb385..87eca3fe89 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt @@ -119,92 +119,44 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item15", new } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Eight_Args", - FullyQualifiedName = "TUnit.TestProject.Bugs._1538.Tests.Eight_Args", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Eight_Args", + fullyQualifiedName: "TUnit.TestProject.Bugs._1538.Tests.Eight_Args", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EightItems") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._1538.Tests.EightItems(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._1538.Tests.EightItems()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "SixteenArgs", - FullyQualifiedName = "TUnit.TestProject.Bugs._1538.Tests.SixteenArgs", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "SixteenArgs", + fullyQualifiedName: "TUnit.TestProject.Bugs._1538.Tests.SixteenArgs", + filePath: "", + lineNumber: 16, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SixteenItems") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._1538.Tests.SixteenItems(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._1538.Tests.SixteenItems()), }, }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt index afacc27012..dcccf1eb9b 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt @@ -66,24 +66,17 @@ internal static class TUnit_TestProject_Bugs__1539_Tests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._1539.Tests.Test", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.Bugs._1539.Tests.Test", + filePath: "", + lineNumber: 8, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt index 426acfb484..eaf217b31f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt @@ -66,29 +66,23 @@ internal static class TUnit_TestProject_Bugs__1589_MyTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1589.MyTests.Test1", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._1589.MyTests.Test1", + filePath: "", + lineNumber: 15, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() {Shared = global::TUnit.Core.SharedType.None,}, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt index cd30d1344b..d72ae86af4 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt @@ -67,29 +67,23 @@ internal static class TUnit_TestProject_Bugs__1594_MyTests__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1594.MyTests.Test1", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._1594.MyTests.Test1", + filePath: "", + lineNumber: 15, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() {Shared = global::TUnit.Core.SharedType.None,}, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt index 49c990ad97..7462668bd1 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt @@ -95,50 +95,38 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(short), "value", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Casted_Integer_To_Short_Converts", - FullyQualifiedName = "TUnit.TestProject.Bugs._1603.Tests.Casted_Integer_To_Short_Converts", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Casted_Integer_To_Short_Converts", + fullyQualifiedName: "TUnit.TestProject.Bugs._1603.Tests.Casted_Integer_To_Short_Converts", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute((short) -123), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Integer_To_Short_Converts", - FullyQualifiedName = "TUnit.TestProject.Bugs._1603.Tests.Integer_To_Short_Converts", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Integer_To_Short_Converts", + fullyQualifiedName: "TUnit.TestProject.Bugs._1603.Tests.Integer_To_Short_Converts", + filePath: "", + lineNumber: 15, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(-123), }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt index 513e7cba4a..19c114ad58 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt @@ -72,29 +72,23 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "t", new glob } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "NullTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._1692.Tests.NullTest", - FilePath = "", - LineNumber = 10, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "NullTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._1692.Tests.NullTest", + filePath: "", + lineNumber: 10, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), new global::TUnit.Core.ArgumentsAttribute(null), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt index 7a4c4ecfa9..61fff15869 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt @@ -99,58 +99,46 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "MethodDataSource", - FullyQualifiedName = "TUnit.TestProject.Bugs._1821.Tests.MethodDataSource", - FilePath = "", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MethodDataSource", + fullyQualifiedName: "TUnit.TestProject.Bugs._1821.Tests.MethodDataSource", + filePath: "", + lineNumber: 9, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.InstanceMethodDataSourceAttribute("DataSource"), }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixDataSource", - FullyQualifiedName = "TUnit.TestProject.Bugs._1821.Tests.MatrixDataSource", - FilePath = "", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixDataSource", + fullyQualifiedName: "TUnit.TestProject.Bugs._1821.Tests.MatrixDataSource", + filePath: "", + lineNumber: 16, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt index cc4b879a86..aa6a6971e3 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -136,28 +129,22 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", ne } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -230,29 +217,23 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", ne } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test3", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(false), new global::TUnit.Core.ArgumentsAttribute(true), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt index cc4b879a86..aa6a6971e3 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -136,28 +129,22 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", ne } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -230,29 +217,23 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", ne } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test3", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(false), new global::TUnit.Core.ArgumentsAttribute(true), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt index cc4b879a86..aa6a6971e3 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -136,28 +129,22 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", ne } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -230,29 +217,23 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", ne } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test3", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(false), new global::TUnit.Core.ArgumentsAttribute(true), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt index 6d48226230..b51b6a96ab 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - FilePath = "", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", + filePath: "", + lineNumber: 6, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -136,28 +129,22 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", ne } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - FilePath = "", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", + filePath: "", + lineNumber: 12, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -230,29 +217,23 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", ne } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - FilePath = "", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test3", + fullyQualifiedName: "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", + filePath: "", + lineNumber: 19, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(false), new global::TUnit.Core.ArgumentsAttribute(true), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt index d25d69ed5a..81d3f74843 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt @@ -47,24 +47,17 @@ internal static class TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1899.DerivedTest.Test1", - FilePath = "", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test1", + fullyQualifiedName: "TUnit.TestProject.Bugs._1899.DerivedTest.Test1", + filePath: "", + lineNumber: 14, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt index 32a60719c5..d9d533f983 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt @@ -73,24 +73,13 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "value", new gl } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "MyTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2083.Tests.MyTest", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MyTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2083.Tests.MyTest", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0), new global::TUnit.Core.ArgumentsAttribute((byte)255), @@ -99,7 +88,12 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "value", new gl new global::TUnit.Core.ArgumentsAttribute(2147483647), new global::TUnit.Core.ArgumentsAttribute(9223372036854775807L), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt index b3c91188b3..a4473bb6f4 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt @@ -95,50 +95,38 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "d", new globa } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Double_SpecialConsts", - FullyQualifiedName = "TUnit.TestProject.Bugs._2085.Tests.Double_SpecialConsts", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Double_SpecialConsts", + fullyQualifiedName: "TUnit.TestProject.Bugs._2085.Tests.Double_SpecialConsts", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Float_SpecialConsts", - FullyQualifiedName = "TUnit.TestProject.Bugs._2085.Tests.Float_SpecialConsts", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Float_SpecialConsts", + fullyQualifiedName: "TUnit.TestProject.Bugs._2085.Tests.Float_SpecialConsts", + filePath: "", + lineNumber: 15, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt index 7c70c2ec91..d4c7dfbe4c 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt @@ -169,52 +169,40 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long[]), "arr", new gl } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._2112.Tests.Test", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test", + fullyQualifiedName: "TUnit.TestProject.Bugs._2112.Tests.Test", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0, 1L), new global::TUnit.Core.ArgumentsAttribute(0, 1L), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._2112.Tests.Test2", - FilePath = "", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "Test2", + fullyQualifiedName: "TUnit.TestProject.Bugs._2112.Tests.Test2", + filePath: "", + lineNumber: 15, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), }, - }, + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt index 9b611061be..59728768f9 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt @@ -146,116 +146,86 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expected", n } public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "GenericArgumentsTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 0, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericArgumentsTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(true, "True"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericArgumentsTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 1, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 1, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 0, + createAttributes: __Attributes_0, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericArgumentsTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "1"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericArgumentsTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 2, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 2, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 1, + createAttributes: __Attributes_0, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericArgumentsTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1, "1.1"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericArgumentsTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 3, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 3, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 2, + createAttributes: __Attributes_0, + attributeGroupIndex: 2), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericArgumentsTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("hello", "hello"), }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "GenericArgumentsTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance_0, - InvokeBody = __Invoke_0, - MethodIndex = 4, - CreateAttributes = __Attributes_0, - AttributeGroupIndex = 4, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 3, + createAttributes: __Attributes_0, + attributeGroupIndex: 3), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "GenericArgumentsTest", + fullyQualifiedName: "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Bugs._2136.MyEnum.Item, "Item"), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance_0, + invokeBody: __Invoke_0, + methodIndex: 4, + createAttributes: __Attributes_0, + attributeGroupIndex: 4), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests5118.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests5118.Test.verified.txt index 0a78670baf..e4c115cf39 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests5118.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests5118.Test.verified.txt @@ -71,42 +71,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threadi } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "TestWithAsyncComplexData", - FullyQualifiedName = "TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests.TestWithAsyncComplexData", - FilePath = "", - LineNumber = 22, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestWithAsyncComplexData", + fullyQualifiedName: "TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests.TestWithAsyncComplexData", + filePath: "", + lineNumber: 22, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("GetAsyncTestData") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._5118.AsyncTestDataSources.GetAsyncTestData(); - await foreach (var item in result) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromAsyncEnumerable(static () => global::TUnit.TestProject.Bugs._5118.AsyncTestDataSources.GetAsyncTestData()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/Tests6150.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests6150.Test.verified.txt index 8fa3bf83b6..a0f54600c1 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests6150.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests6150.Test.verified.txt @@ -96,49 +96,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte[][]), "data", new } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "JaggedArray", - FullyQualifiedName = "TUnit.TestProject.Bugs._6150.Tests.JaggedArray", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "JaggedArray", + fullyQualifiedName: "TUnit.TestProject.Bugs._6150.Tests.JaggedArray", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("Data") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._6150.Tests.Data(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.Bugs._6150.Tests.Data()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/TestsBase.cs b/TUnit.Core.SourceGenerator.Tests/TestsBase.cs index 949d519755..073a372ddf 100644 --- a/TUnit.Core.SourceGenerator.Tests/TestsBase.cs +++ b/TUnit.Core.SourceGenerator.Tests/TestsBase.cs @@ -169,7 +169,13 @@ Have you added required references and additional files? .ScrubFilePaths() .ScrubLinesContaining("StartColumnNumber = ") .ScrubLinesContaining("EndLineNumber = ") - .ScrubLinesContaining("EndColumnNumber = "); + .ScrubLinesContaining("EndColumnNumber = ") + // Named-argument forms emitted at TestEntryFactory.Create call sites — these lines + // are also omitted entirely when the value is zero, which combined with this scrubbing + // keeps snapshots stable across Roslyn versions that report different column spans. + .ScrubLinesContaining("startColumnNumber: ") + .ScrubLinesContaining("endLineNumber: ") + .ScrubLinesContaining("endColumnNumber: "); if (runTestOptions.VerifyConfigurator != null) { diff --git a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt index a917095cf5..380a4adb64 100644 --- a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt @@ -231,297 +231,141 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threadi } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DefaultTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DefaultTest", - FilePath = "", - LineNumber = 14, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DefaultTest", + fullyQualifiedName: "TUnit.TestProject.TimeoutCancellationTokenTests.DefaultTest", + filePath: "", + lineNumber: 14, + categories: new string[] { "Timeout Cancellation Token Tests" }, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "BasicTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.BasicTest", - FilePath = "", - LineNumber = 21, - Categories = new string[] { "Blah", "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_1, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 1, - CreateAttributes = __Attributes, - AttributeGroupIndex = 1, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "BasicTest", + fullyQualifiedName: "TUnit.TestProject.TimeoutCancellationTokenTests.BasicTest", + filePath: "", + lineNumber: 21, + categories: new string[] { "Blah", "Timeout Cancellation Token Tests" }, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "InheritedTimeoutAttribute", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.InheritedTimeoutAttribute", - FilePath = "", - LineNumber = 30, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_2, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 2, - CreateAttributes = __Attributes, - AttributeGroupIndex = 2, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_1, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 1, + createAttributes: __Attributes, + attributeGroupIndex: 1), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "InheritedTimeoutAttribute", + fullyQualifiedName: "TUnit.TestProject.TimeoutCancellationTokenTests.InheritedTimeoutAttribute", + filePath: "", + lineNumber: 30, + categories: new string[] { "Timeout Cancellation Token Tests" }, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DataTest", - FilePath = "", - LineNumber = 38, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_3, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 3, - CreateAttributes = __Attributes, - AttributeGroupIndex = 3, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_2, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 2, + createAttributes: __Attributes, + attributeGroupIndex: 2), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataTest", + fullyQualifiedName: "TUnit.TestProject.TimeoutCancellationTokenTests.DataTest", + filePath: "", + lineNumber: 38, + categories: new string[] { "Timeout Cancellation Token Tests" }, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "DataSourceTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DataSourceTest", - FilePath = "", - LineNumber = 48, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_4, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 4, - CreateAttributes = __Attributes, - AttributeGroupIndex = 4, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_3, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 3, + createAttributes: __Attributes, + attributeGroupIndex: 3), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSourceTest", + fullyQualifiedName: "TUnit.TestProject.TimeoutCancellationTokenTests.DataSourceTest", + filePath: "", + lineNumber: 48, + categories: new string[] { "Timeout Cancellation Token Tests" }, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource()), }, }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource()), }, }, - }, - new global::TUnit.Core.TestEntry - { - MethodName = "MatrixTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.MatrixTest", - FilePath = "", - LineNumber = 58, - Categories = new string[] { "Blah", "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_5, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 5, - CreateAttributes = __Attributes, - AttributeGroupIndex = 5, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + methodMetadata: __mm_4, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 4, + createAttributes: __Attributes, + attributeGroupIndex: 4), + global::TUnit.Core.TestEntryFactory.Create( + methodName: "MatrixTest", + fullyQualifiedName: "TUnit.TestProject.TimeoutCancellationTokenTests.MatrixTest", + filePath: "", + lineNumber: 58, + categories: new string[] { "Blah", "Timeout Cancellation Token Tests" }, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), }, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource()), }, }, - }, + methodMetadata: __mm_5, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 5, + createAttributes: __Attributes, + attributeGroupIndex: 5), }; } internal static partial class TUnit_TestRegistration @@ -604,49 +448,26 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threadi } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "QuickTestDoesNotTimeout", - FullyQualifiedName = "TUnit.TestProject.TimeoutDoesNotFireTests.QuickTestDoesNotTimeout", - FilePath = "", - LineNumber = 86, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "QuickTestDoesNotTimeout", + fullyQualifiedName: "TUnit.TestProject.TimeoutDoesNotFireTests.QuickTestDoesNotTimeout", + filePath: "", + lineNumber: 86, + categories: new string[] { "Timeout Cancellation Token Tests" }, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutDoesNotFireTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.TimeoutDoesNotFireTests.DataSource()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration @@ -729,49 +550,26 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threadi } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "CancellationTokenIsTriggered", - FullyQualifiedName = "TUnit.TestProject.CancellationTokenTriggeredTests.CancellationTokenIsTriggered", - FilePath = "", - LineNumber = 106, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "CancellationTokenIsTriggered", + fullyQualifiedName: "TUnit.TestProject.CancellationTokenTriggeredTests.CancellationTokenIsTriggered", + filePath: "", + lineNumber: 106, + categories: new string[] { "Timeout Cancellation Token Tests" }, + hasDataSource: true, + classDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CancellationTokenTriggeredTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromEnumerable(static () => global::TUnit.TestProject.CancellationTokenTriggeredTests.DataSource()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt index aa67a031d6..ea9fde58aa 100644 --- a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt @@ -75,39 +75,25 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new g } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "DataSource_TupleMethod", - FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "DataSource_TupleMethod", + fullyQualifiedName: "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", + filePath: "", + lineNumber: 8, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + Factory = static dataGeneratorMetadata => global::TUnit.Core.Helpers.DataSourceFactories.FromValue(static () => global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod()), }, }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt index 1194f15988..dbdeadeb5e 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt @@ -74,29 +74,23 @@ global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "c", new global: } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "TestWithDataSource", - FullyQualifiedName = "TUnit.TestProject.AotDataSourceTest.TestWithDataSource", - FilePath = "", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestWithDataSource", + fullyQualifiedName: "TUnit.TestProject.AotDataSourceTest.TestWithDataSource", + filePath: "", + lineNumber: 7, + hasDataSource: true, + testDataSources: new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, 2, 3), new global::TUnit.Core.ArgumentsAttribute(4, 5, 6), }, - }, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt index 33fd24e39e..1a7eca6b68 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt @@ -61,24 +61,17 @@ internal static class TUnit_TestProject_ConfigurationTest__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "TestWithConfiguration", - FullyQualifiedName = "TUnit.TestProject.ConfigurationTest.TestWithConfiguration", - FilePath = "", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestWithConfiguration", + fullyQualifiedName: "TUnit.TestProject.ConfigurationTest.TestWithConfiguration", + filePath: "", + lineNumber: 7, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt index b847a54107..5cb67437e9 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt @@ -61,24 +61,17 @@ internal static class TUnit_TestProject_ModuleInitializerTest__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "TestWithModuleInit", - FullyQualifiedName = "TUnit.TestProject.ModuleInitializerTest.TestWithModuleInit", - FilePath = "", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestWithModuleInit", + fullyQualifiedName: "TUnit.TestProject.ModuleInitializerTest.TestWithModuleInit", + filePath: "", + lineNumber: 8, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt index 49c980619b..8bf9e6b3b3 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt @@ -61,24 +61,17 @@ internal static class TUnit_TestProject_TypedDelegateTest__TestSource } public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - new global::TUnit.Core.TestEntry - { - MethodName = "TestWithDelegate", - FullyQualifiedName = "TUnit.TestProject.TypedDelegateTest.TestWithDelegate", - FilePath = "", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - MethodMetadata = __mm_0, - CreateInstance = __CreateInstance, - InvokeBody = __Invoke, - MethodIndex = 0, - CreateAttributes = __Attributes, - AttributeGroupIndex = 0, - }, + global::TUnit.Core.TestEntryFactory.Create( + methodName: "TestWithDelegate", + fullyQualifiedName: "TUnit.TestProject.TypedDelegateTest.TestWithDelegate", + filePath: "", + lineNumber: 7, + methodMetadata: __mm_0, + createInstance: __CreateInstance, + invokeBody: __Invoke, + methodIndex: 0, + createAttributes: __Attributes, + attributeGroupIndex: 0), }; } internal static partial class TUnit_TestRegistration diff --git a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs index 76eaf84af6..d4ede2cc0c 100644 --- a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs +++ b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Globalization; using System.Text; using Microsoft.CodeAnalysis; @@ -488,19 +488,18 @@ private static void GenerateTestMetadata(CodeWriter writer, TestMethodMetadata t writer.Unindent(); writer.AppendLine("}"); - // TestEntry array + // TestEntry array — entries built via the shared TestEntryFactory so each call site + // is a single factory call instead of a large object initializer (#6227) writer.AppendLine($"public static readonly global::TUnit.Core.TestEntry<{concreteClassName}>[] Entries_{groupIndex} = new global::TUnit.Core.TestEntry<{concreteClassName}>[]"); writer.AppendLine("{"); writer.Indent(); for (var i = 0; i < entries.Count; i++) { var entry = entries[i]; - writer.AppendLine($"new global::TUnit.Core.TestEntry<{concreteClassName}>"); - writer.AppendLine("{"); + writer.AppendLine($"global::TUnit.Core.TestEntryFactory.Create<{concreteClassName}>("); writer.Indent(); EmitTestEntryFields(writer, testMethod, entry, i, groupIndex); writer.Unindent(); - writer.AppendLine("},"); } writer.Unindent(); writer.AppendLine("};"); @@ -1072,38 +1071,10 @@ private static void EmitTestEntryFields(CodeWriter writer, TestMethodMetadata te ? $"{displayClassName}.{methodName}" : $"{namespaceName}.{displayClassName}.{methodName}"; - var categories = ExtractCategories(testMethod); - var categoriesArray = categories.Count == 0 - ? "global::System.Array.Empty()" - : $"new string[] {{ {string.Join(", ", categories.Select(c => $"\"{EscapeString(c)}\""))} }}"; - - var properties = ExtractProperties(testMethod); - var propertiesArray = properties.Length == 0 - ? "global::System.Array.Empty()" - : $"new string[] {{ {string.Join(", ", properties.Select(p => $"\"{EscapeString(p)}\""))} }}"; - - var hasDataSource = HasDataSources(testMethod); - var repeatCount = ExtractRepeatCount(testMethod); - - var dependsOn = ExtractDependsOn(testMethod); - var dependsOnArray = dependsOn.Length == 0 - ? "global::System.Array.Empty()" - : $"new string[] {{ {string.Join(", ", dependsOn.Select(d => $"\"{EscapeString(d)}\""))} }}"; - - writer.AppendLine($"MethodName = \"{EscapeString(entry.TestName)}\","); - writer.AppendLine($"FullyQualifiedName = \"{EscapeString(fullyQualifiedName)}\","); - WriteSourceLocationMetadata(writer, testMethod); - writer.AppendLine($"Categories = {categoriesArray},"); - writer.AppendLine($"Properties = {propertiesArray},"); - writer.AppendLine($"HasDataSource = {(hasDataSource ? "true" : "false")},"); - writer.AppendLine($"RepeatCount = {repeatCount},"); - writer.AppendLine($"DependsOn = {dependsOnArray},"); - writer.AppendLine($"MethodMetadata = __mm_0,"); - writer.AppendLine($"CreateInstance = __CreateInstance_{groupIndex},"); - writer.AppendLine($"InvokeBody = __Invoke_{groupIndex},"); - writer.AppendLine($"MethodIndex = {entryIndex},"); - writer.AppendLine($"CreateAttributes = __Attributes_{groupIndex},"); - writer.AppendLine($"AttributeGroupIndex = {entryIndex},"); + writer.AppendLine($"methodName: \"{EscapeString(entry.TestName)}\","); + writer.AppendLine($"fullyQualifiedName: \"{EscapeString(fullyQualifiedName)}\","); + WriteSourceLocationArguments(writer, testMethod); + WriteFilterDataArguments(writer, testMethod); // Data sources EmitConcreteDataSources(writer, testMethod, entry); @@ -1112,7 +1083,50 @@ private static void EmitTestEntryFields(CodeWriter writer, TestMethodMetadata te var depsExpr = PreGenerateDependenciesExpression(testMethod.MethodSymbol); if (depsExpr != null) { - writer.AppendLine($"Dependencies = {depsExpr},"); + writer.AppendLine($"dependencies: {depsExpr},"); + } + + writer.AppendLine($"methodMetadata: __mm_0,"); + writer.AppendLine($"createInstance: __CreateInstance_{groupIndex},"); + writer.AppendLine($"invokeBody: __Invoke_{groupIndex},"); + writer.AppendLine($"methodIndex: {entryIndex},"); + writer.AppendLine($"createAttributes: __Attributes_{groupIndex},"); + writer.AppendLine($"attributeGroupIndex: {entryIndex}),"); + } + + /// + /// Writes the optional filter-data named arguments (categories, properties, hasDataSource, + /// repeatCount, dependsOn) for a TestEntryFactory.Create call, omitting factory defaults. + /// + private static void WriteFilterDataArguments(CodeWriter writer, TestMethodMetadata testMethod) + { + var categories = ExtractCategories(testMethod); + if (categories.Count > 0) + { + writer.AppendLine($"categories: new string[] {{ {string.Join(", ", categories.Select(c => $"\"{EscapeString(c)}\""))} }},"); + } + + var properties = ExtractProperties(testMethod); + if (properties.Length > 0) + { + writer.AppendLine($"properties: new string[] {{ {string.Join(", ", properties.Select(p => $"\"{EscapeString(p)}\""))} }},"); + } + + if (HasDataSources(testMethod)) + { + writer.AppendLine("hasDataSource: true,"); + } + + var repeatCount = ExtractRepeatCount(testMethod); + if (repeatCount != 0) + { + writer.AppendLine($"repeatCount: {repeatCount},"); + } + + var dependsOn = ExtractDependsOn(testMethod); + if (dependsOn.Length > 0) + { + writer.AppendLine($"dependsOn: new string[] {{ {string.Join(", ", dependsOn.Select(d => $"\"{EscapeString(d)}\""))} }},"); } } @@ -1180,7 +1194,7 @@ private static void EmitConcreteDataSources(CodeWriter writer, TestMethodMetadat } dsWriter.Unindent(); dsWriter.Append("}"); - writer.AppendLine($"TestDataSources = {dsWriter},"); + writer.AppendLine($"testDataSources: {dsWriter},"); } if (classDataSources.Length > 0) @@ -1195,7 +1209,7 @@ private static void EmitConcreteDataSources(CodeWriter writer, TestMethodMetadat } dsWriter.Unindent(); dsWriter.Append("}"); - writer.AppendLine($"ClassDataSources = {dsWriter},"); + writer.AppendLine($"classDataSources: {dsWriter},"); } } @@ -1257,6 +1271,29 @@ private static void WriteSourceLocationMetadata(CodeWriter writer, TestMethodMet writer.AppendLine($"EndColumnNumber = {testMethod.EndColumnNumber},"); } + /// + /// Named-argument twin of for TestEntryFactory.Create + /// call sites. Column/end-location values are omitted when zero (the factory default) — snapshot + /// scrubbing removes these lines anyway, so presence differences across Roslyn versions are benign. + /// + private static void WriteSourceLocationArguments(CodeWriter writer, TestMethodMetadata testMethod) + { + writer.AppendLine($"filePath: {SymbolDisplay.FormatLiteral(testMethod.FilePath ?? "", quote: true)},"); + writer.AppendLine($"lineNumber: {testMethod.LineNumber},"); + if (testMethod.StartColumnNumber != 0) + { + writer.AppendLine($"startColumnNumber: {testMethod.StartColumnNumber},"); + } + if (testMethod.EndLineNumber != 0) + { + writer.AppendLine($"endLineNumber: {testMethod.EndLineNumber},"); + } + if (testMethod.EndColumnNumber != 0) + { + writer.AppendLine($"endColumnNumber: {testMethod.EndColumnNumber},"); + } + } + private static void GenerateMetadataForConcreteInstantiation(CodeWriter writer, TestMethodMetadata testMethod) { var compilation = testMethod.Context!.Value.SemanticModel.Compilation; @@ -1645,389 +1682,93 @@ private static void GenerateMethodDataSourceAttribute(CodeWriter writer, Attribu writer.AppendLine("DeferEnumeration = true,"); } - // Set the Factory property with a strongly-typed function - writer.AppendLine("Factory = (dataGeneratorMetadata) =>"); - writer.AppendLine("{"); - writer.Indent(); - - // If we have arguments, capture them in local variables - if (hasArguments) - { - writer.AppendLine("// Capture Arguments from the attribute"); - writer.Append("var arguments = "); - WriteTypedConstant(writer, argumentsProperty.Value); - writer.AppendLine(";"); - writer.AppendLine(); - } - - // Generate the factory implementation - if (dataSourceMethod != null) - { - GenerateMethodDataSourceFactory(writer, dataSourceMethod, targetType, hasArguments); - } - else if (dataSourceProperty != null) - { - GeneratePropertyDataSourceFactory(writer, dataSourceProperty, targetType); - } - - writer.Unindent(); - writer.AppendLine("}"); + // Set the Factory property as a single expression calling a shared TUnit.Core helper. + // The helper holds the (previously inlined) async iterator body, so each call site avoids + // a per-data-source compiler-generated state machine class (#6227). Only the per-test-unique + // invocation is emitted, as a static lambda. + writer.Append("Factory = static dataGeneratorMetadata => "); + EmitDataSourceFactoryInvocation(writer, dataSourceMember, targetType, hasArguments ? argumentsProperty.Value : (TypedConstant?)null); + writer.AppendLine(","); writer.Unindent(); writer.AppendLine("},"); } - private static void GenerateMethodDataSourceFactory(CodeWriter writer, IMethodSymbol dataSourceMethod, ITypeSymbol targetType, bool hasArguments) + /// + /// Emits a call to a TUnit.Core.Helpers.DataSourceFactories helper, passing the + /// data source member invocation as a static lambda. The helper is selected from the + /// member's declared return type (mirroring the previous inline-iterator branch order) + /// and whether the member is static or instance-based. + /// + private static void EmitDataSourceFactoryInvocation(CodeWriter writer, ISymbol dataSourceMember, ITypeSymbol targetType, TypedConstant? arguments) { - var isStatic = dataSourceMethod.IsStatic; - var returnType = dataSourceMethod.ReturnType; - var fullyQualifiedType = targetType.GloballyQualified(); + var dataSourceMethod = dataSourceMember as IMethodSymbol; + var dataSourceProperty = dataSourceMember as IPropertySymbol; - // Generate async enumerable that yields Func> - writer.AppendLine("async global::System.Collections.Generic.IAsyncEnumerable>> Factory()"); - writer.AppendLine("{"); - writer.Indent(); + var returnType = dataSourceMethod?.ReturnType ?? dataSourceProperty!.Type; + var isStatic = dataSourceMethod?.IsStatic ?? dataSourceProperty!.IsStatic; + var fullyQualifiedType = targetType.GloballyQualified(); - // Build the method call with arguments if needed - string methodCall; - if (hasArguments && dataSourceMethod.Parameters.Length > 0) - { - // Use the captured arguments - var argsList = string.Join(", ", dataSourceMethod.Parameters.Select((p, i) => - $"(({p.Type.GloballyQualified()})arguments[{i}])")); - methodCall = $"{dataSourceMethod.Name}({argsList})"; - } - else + string kind; + if (IsAsyncEnumerable(returnType)) { - methodCall = $"{dataSourceMethod.Name}()"; + kind = "AsyncEnumerable"; } - - // For collections (IEnumerable, IAsyncEnumerable), we need to evaluate once to iterate - // For single values, we'll generate a lambda that invokes the method each time - returnType.ToDisplayString(); - - if (IsAsyncEnumerable(returnType)) + else if (IsValueTask(returnType)) { - // IAsyncEnumerable - must evaluate once to iterate - if (isStatic) - { - writer.AppendLine($"var result = {fullyQualifiedType}.{methodCall};"); - } - else - { - writer.AppendLine("object? instance;"); - writer.AppendLine("if (dataGeneratorMetadata.TestClassInstance != null)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("instance = dataGeneratorMetadata.TestClassInstance;"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("throw new global::System.InvalidOperationException(\"Instance method data source requires TestClassInstance. This should have been provided by the engine.\");"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine($"var result = (({fullyQualifiedType})instance).{methodCall};"); - } - writer.AppendLine(); - writer.AppendLine("await foreach (var item in result)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item));"); - writer.Unindent(); - writer.AppendLine("}"); + kind = "ValueTask"; } else if (IsTask(returnType)) { - // Task - must evaluate and await once - if (isStatic) - { - writer.AppendLine($"var result = {fullyQualifiedType}.{methodCall};"); - } - else - { - writer.AppendLine("object? instance;"); - writer.AppendLine("if (dataGeneratorMetadata.TestClassInstance != null)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("instance = dataGeneratorMetadata.TestClassInstance;"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("throw new global::System.InvalidOperationException(\"Instance method data source requires TestClassInstance. This should have been provided by the engine.\");"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine($"var result = (({fullyQualifiedType})instance).{methodCall};"); - } - writer.AppendLine(); - writer.AppendLine("var taskResult = await result;"); - writer.AppendLine("if (taskResult is global::System.Collections.IEnumerable enumerable && !(taskResult is string))"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("foreach (var item in enumerable)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item));"); - writer.Unindent(); - writer.AppendLine("}"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(taskResult));"); - writer.Unindent(); - writer.AppendLine("}"); + kind = "Task"; } else if (IsEnumerable(returnType)) { - // IEnumerable - if (isStatic) - { - writer.AppendLine($"var result = {fullyQualifiedType}.{methodCall};"); - } - else - { - writer.AppendLine("object? instance;"); - writer.AppendLine("if (dataGeneratorMetadata.TestClassInstance != null)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("instance = dataGeneratorMetadata.TestClassInstance;"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("throw new global::System.InvalidOperationException(\"Instance method data source requires TestClassInstance. This should have been provided by the engine.\");"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine($"var result = (({fullyQualifiedType})instance).{methodCall};"); - } - writer.AppendLine(); - writer.AppendLine("if (result is global::System.Collections.IEnumerable enumerable && !(result is string))"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("foreach (var item in enumerable)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item));"); - writer.Unindent(); - writer.AppendLine("}"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result));"); - writer.Unindent(); - writer.AppendLine("}"); + kind = "Enumerable"; } else { - // Single value - if (isStatic) - { - writer.AppendLine($"var result = {fullyQualifiedType}.{methodCall};"); - } - else - { - writer.AppendLine("object? instance;"); - writer.AppendLine("if (dataGeneratorMetadata.TestClassInstance != null)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("instance = dataGeneratorMetadata.TestClassInstance;"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("throw new global::System.InvalidOperationException(\"Instance method data source requires TestClassInstance. This should have been provided by the engine.\");"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine($"var result = (({fullyQualifiedType})instance).{methodCall};"); - } - writer.AppendLine(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result));"); + kind = "Value"; } - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine(); - - - writer.AppendLine("return Factory();"); - } - - private static void GeneratePropertyDataSourceFactory(CodeWriter writer, IPropertySymbol dataSourceProperty, ITypeSymbol targetType) - { - var isStatic = dataSourceProperty.IsStatic; - var returnType = dataSourceProperty.Type; - var fullyQualifiedType = targetType.GloballyQualified(); - - // Generate async enumerable that yields Func> - writer.AppendLine("async global::System.Collections.Generic.IAsyncEnumerable>> Factory()"); - writer.AppendLine("{"); - writer.Indent(); + var helper = isStatic + ? $"global::TUnit.Core.Helpers.DataSourceFactories.From{kind}" + : $"global::TUnit.Core.Helpers.DataSourceFactories.FromInstance{kind}"; - // Properties don't have arguments, just access them - var propertyAccess = dataSourceProperty.Name; + var hasArguments = arguments != null && dataSourceMethod is { Parameters.Length: > 0 }; - if (IsAsyncEnumerable(returnType)) + string memberAccess; + if (dataSourceMethod != null) { - // IAsyncEnumerable - must evaluate once to iterate - if (isStatic) - { - writer.AppendLine($"var result = {fullyQualifiedType}.{propertyAccess};"); - } - else - { - writer.AppendLine("object? instance;"); - writer.AppendLine("if (dataGeneratorMetadata.TestClassInstance != null)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("instance = dataGeneratorMetadata.TestClassInstance;"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("throw new global::System.InvalidOperationException(\"Instance method data source requires TestClassInstance. This should have been provided by the engine.\");"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine($"var result = (({fullyQualifiedType})instance).{propertyAccess};"); - } - writer.AppendLine(); - writer.AppendLine("await foreach (var item in result)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item));"); - writer.Unindent(); - writer.AppendLine("}"); + memberAccess = hasArguments + ? $"{dataSourceMethod.Name}({string.Join(", ", dataSourceMethod.Parameters.Select((p, i) => $"(({p.Type.GloballyQualified()})arguments[{i}])"))})" + : $"{dataSourceMethod.Name}()"; } - else if (IsTask(returnType)) + else { - // Task - must evaluate and await once - if (isStatic) - { - writer.AppendLine($"var result = {fullyQualifiedType}.{propertyAccess};"); - } - else - { - writer.AppendLine("object? instance;"); - writer.AppendLine("if (dataGeneratorMetadata.TestClassInstance != null)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("instance = dataGeneratorMetadata.TestClassInstance;"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("throw new global::System.InvalidOperationException(\"Instance method data source requires TestClassInstance. This should have been provided by the engine.\");"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine($"var result = (({fullyQualifiedType})instance).{propertyAccess};"); - } - writer.AppendLine(); - writer.AppendLine("var taskResult = await result;"); - writer.AppendLine("if (taskResult is global::System.Collections.IEnumerable enumerable && !(taskResult is string))"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("foreach (var item in enumerable)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item));"); - writer.Unindent(); - writer.AppendLine("}"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(taskResult));"); - writer.Unindent(); - writer.AppendLine("}"); + memberAccess = dataSourceProperty!.Name; } - else if (IsEnumerable(returnType)) + + var receiver = isStatic ? fullyQualifiedType : $"(({fullyQualifiedType})instance)"; + var lambdaHeader = isStatic ? "static () =>" : "static instance =>"; + var metadataArgument = isStatic ? "" : "dataGeneratorMetadata, "; + + if (hasArguments) { - // IEnumerable - if (isStatic) - { - writer.AppendLine($"var result = {fullyQualifiedType}.{propertyAccess};"); - } - else - { - writer.AppendLine("object? instance;"); - writer.AppendLine("if (dataGeneratorMetadata.TestClassInstance != null)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("instance = dataGeneratorMetadata.TestClassInstance;"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("throw new global::System.InvalidOperationException(\"Instance method data source requires TestClassInstance. This should have been provided by the engine.\");"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine($"var result = (({fullyQualifiedType})instance).{propertyAccess};"); - } - writer.AppendLine(); - writer.AppendLine("if (result is global::System.Collections.IEnumerable enumerable && !(result is string))"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("foreach (var item in enumerable)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item));"); - writer.Unindent(); - writer.AppendLine("}"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); + writer.AppendLine($"{helper}({metadataArgument}{lambdaHeader}"); writer.AppendLine("{"); writer.Indent(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result));"); + writer.Append("var arguments = "); + WriteTypedConstant(writer, arguments!.Value); + writer.AppendLine(";"); + writer.AppendLine($"return {receiver}.{memberAccess};"); writer.Unindent(); - writer.AppendLine("}"); + writer.Append("})"); } else { - // Single value - if (isStatic) - { - writer.AppendLine($"var result = {fullyQualifiedType}.{propertyAccess};"); - } - else - { - writer.AppendLine("object? instance;"); - writer.AppendLine("if (dataGeneratorMetadata.TestClassInstance != null)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("instance = dataGeneratorMetadata.TestClassInstance;"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("throw new global::System.InvalidOperationException(\"Instance method data source requires TestClassInstance. This should have been provided by the engine.\");"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine($"var result = (({fullyQualifiedType})instance).{propertyAccess};"); - } - writer.AppendLine(); - writer.AppendLine("yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result));"); + writer.Append($"{helper}({metadataArgument}{lambdaHeader} {receiver}.{memberAccess})"); } - - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine(); - - - writer.AppendLine("return Factory();"); } private static bool IsAsyncEnumerable(ITypeSymbol type) @@ -2035,11 +1776,14 @@ private static bool IsAsyncEnumerable(ITypeSymbol type) return InterfaceHelper.IsAsyncEnumerable(type); } + private static bool IsValueTask(ITypeSymbol type) + { + return type.ToDisplayString().StartsWith("System.Threading.Tasks.ValueTask"); + } + private static bool IsTask(ITypeSymbol type) { - var typeName = type.ToDisplayString(); - return typeName.StartsWith("System.Threading.Tasks.Task") || - typeName.StartsWith("System.Threading.Tasks.ValueTask"); + return type.ToDisplayString().StartsWith("System.Threading.Tasks.Task"); } private static bool IsEnumerable(ITypeSymbol type) @@ -3157,32 +2901,10 @@ private static string PreGenerateTestEntryDataFields(TestMethodMetadata testMeth ? $"{simpleClassName}.{methodName}" : $"{namespaceName}.{simpleClassName}.{methodName}"; - var categories = ExtractCategories(testMethod); - var categoriesArray = categories.Count == 0 - ? "global::System.Array.Empty()" - : $"new string[] {{ {string.Join(", ", categories.Select(c => $"\"{EscapeString(c)}\""))} }}"; - - var properties = ExtractProperties(testMethod); - var propertiesArray = properties.Length == 0 - ? "global::System.Array.Empty()" - : $"new string[] {{ {string.Join(", ", properties.Select(p => $"\"{EscapeString(p)}\""))} }}"; - - var hasDataSource = HasDataSources(testMethod); - var repeatCount = ExtractRepeatCount(testMethod); - - var dependsOn = ExtractDependsOn(testMethod); - var dependsOnArray = dependsOn.Length == 0 - ? "global::System.Array.Empty()" - : $"new string[] {{ {string.Join(", ", dependsOn.Select(d => $"\"{EscapeString(d)}\""))} }}"; - - writer.AppendLine($"MethodName = \"{EscapeString(methodName)}\","); - writer.AppendLine($"FullyQualifiedName = \"{EscapeString(fullyQualifiedName)}\","); - WriteSourceLocationMetadata(writer, testMethod); - writer.AppendLine($"Categories = {categoriesArray},"); - writer.AppendLine($"Properties = {propertiesArray},"); - writer.AppendLine($"HasDataSource = {(hasDataSource ? "true" : "false")},"); - writer.AppendLine($"RepeatCount = {repeatCount},"); - writer.AppendLine($"DependsOn = {dependsOnArray},"); + writer.AppendLine($"methodName: \"{EscapeString(methodName)}\","); + writer.AppendLine($"fullyQualifiedName: \"{EscapeString(fullyQualifiedName)}\","); + WriteSourceLocationArguments(writer, testMethod); + WriteFilterDataArguments(writer, testMethod); return writer.ToString(); } @@ -3625,36 +3347,36 @@ private static void GeneratePerClassTestSource(SourceProductionContext context, writer.Unindent(); writer.AppendLine("}"); - // TestEntry[] array — all entries share the same 3 delegates + // TestEntry[] array — all entries share the same 3 delegates and are built via the + // shared TestEntryFactory so each call site is a single factory call instead of a + // large object initializer (#6227) writer.AppendLine($"public static readonly global::TUnit.Core.TestEntry<{classGroup.ClassFullyQualified}>[] Entries = new global::TUnit.Core.TestEntry<{classGroup.ClassFullyQualified}>[]"); writer.AppendLine("{"); writer.Indent(); foreach (var method in classGroup.Methods) { - writer.AppendLine($"new global::TUnit.Core.TestEntry<{classGroup.ClassFullyQualified}>"); - writer.AppendLine("{"); + writer.AppendLine($"global::TUnit.Core.TestEntryFactory.Create<{classGroup.ClassFullyQualified}>("); writer.Indent(); writer.AppendRaw(method.TestEntryDataFieldsCode); - writer.AppendLine($"MethodMetadata = __mm_{method.MethodIndex},"); - writer.AppendLine($"CreateInstance = __CreateInstance,"); - writer.AppendLine($"InvokeBody = __Invoke,"); - writer.AppendLine($"MethodIndex = {method.MethodIndex},"); - writer.AppendLine($"CreateAttributes = __Attributes,"); - writer.AppendLine($"AttributeGroupIndex = {method.AttributeGroupIndex},"); if (method.TestDataSourcesCode != null) { - writer.AppendLine($"TestDataSources = {method.TestDataSourcesCode},"); + writer.AppendLine($"testDataSources: {method.TestDataSourcesCode},"); } if (method.ClassDataSourcesCode != null) { - writer.AppendLine($"ClassDataSources = {method.ClassDataSourcesCode},"); + writer.AppendLine($"classDataSources: {method.ClassDataSourcesCode},"); } if (method.DependenciesCode != null) { - writer.AppendLine($"Dependencies = {method.DependenciesCode},"); + writer.AppendLine($"dependencies: {method.DependenciesCode},"); } + writer.AppendLine($"methodMetadata: __mm_{method.MethodIndex},"); + writer.AppendLine($"createInstance: __CreateInstance,"); + writer.AppendLine($"invokeBody: __Invoke,"); + writer.AppendLine($"methodIndex: {method.MethodIndex},"); + writer.AppendLine($"createAttributes: __Attributes,"); + writer.AppendLine($"attributeGroupIndex: {method.AttributeGroupIndex}),"); writer.Unindent(); - writer.AppendLine("},"); } writer.Unindent(); writer.AppendLine("};"); diff --git a/TUnit.Core/Helpers/DataSourceFactories.cs b/TUnit.Core/Helpers/DataSourceFactories.cs new file mode 100644 index 0000000000..33b46603c1 --- /dev/null +++ b/TUnit.Core/Helpers/DataSourceFactories.cs @@ -0,0 +1,195 @@ +// Sync helper variants (FromValue/FromEnumerable and their instance twins) are async iterators +// with no await — intentional, so the data-source invocation stays deferred to first enumeration +// with semantics identical to the previously generated per-call-site iterators. CS1998 is +// suppressed only around those methods (not file-scope) so a genuine missing await elsewhere +// still surfaces. + +using System.Collections; +using System.ComponentModel; + +namespace TUnit.Core.Helpers; + +/// +/// Shared factory helpers invoked by source-generated data source attributes. +/// +/// +/// +/// Each helper replaces a per-call-site compiler-generated async iterator that the source +/// generator previously emitted inline for every [MethodDataSource]. Centralizing the +/// iterator bodies here means they are JIT-compiled once instead of once per data source, +/// shrinking generated IL and discovery-time tier-0 JIT cost. Generated code passes only the +/// per-test-unique invocation as a static lambda. +/// +/// +/// The helper variants mirror the generator's compile-time dispatch on the data member's +/// declared return type: IAsyncEnumerable<T>, Task<T>/ValueTask<T>, +/// IEnumerable, or a single value. The single-value variants intentionally skip the +/// runtime check so an object-declared return holding a +/// collection is still treated as one value — matching the previous generated code exactly. +/// +/// +#if !DEBUG +[EditorBrowsable(EditorBrowsableState.Never)] +#endif +public static class DataSourceFactories +{ +#pragma warning disable CS1998 // sync-only async iterators: deferred invocation, no await by design + /// Data member declared as a single (non-enumerable, non-task) value. + public static async IAsyncEnumerable>> FromValue(Func invoke) + { + var result = invoke(); + + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(result)); + } + + /// Data member declared as a synchronous enumerable. + public static async IAsyncEnumerable>> FromEnumerable(Func invoke) + { + var result = invoke(); + + if (result is IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(result)); + } + } +#pragma warning restore CS1998 + + /// Data member declared as Task<T>. + public static async IAsyncEnumerable>> FromTask(Func> invoke) + { + var result = invoke(); + + var taskResult = await result; + if (taskResult is IEnumerable enumerable && !(taskResult is string)) + { + foreach (var item in enumerable) + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(taskResult)); + } + } + + /// Data member declared as ValueTask<T>. + public static async IAsyncEnumerable>> FromValueTask(Func> invoke) + { + var result = invoke(); + + var taskResult = await result; + if (taskResult is IEnumerable enumerable && !(taskResult is string)) + { + foreach (var item in enumerable) + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(taskResult)); + } + } + + /// Data member declared as IAsyncEnumerable<T>. + public static async IAsyncEnumerable>> FromAsyncEnumerable(Func> invoke) + { + var result = invoke(); + + await foreach (var item in result) + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(item)); + } + } + +#pragma warning disable CS1998 // sync-only async iterators: deferred invocation, no await by design + /// Instance data member declared as a single (non-enumerable, non-task) value. + public static async IAsyncEnumerable>> FromInstanceValue(DataGeneratorMetadata dataGeneratorMetadata, Func invoke) + { + var result = invoke(GetRequiredInstance(dataGeneratorMetadata)); + + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(result)); + } + + /// Instance data member declared as a synchronous enumerable. + public static async IAsyncEnumerable>> FromInstanceEnumerable(DataGeneratorMetadata dataGeneratorMetadata, Func invoke) + { + var result = invoke(GetRequiredInstance(dataGeneratorMetadata)); + + if (result is IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(result)); + } + } +#pragma warning restore CS1998 + + /// Instance data member declared as Task<T>. + public static async IAsyncEnumerable>> FromInstanceTask(DataGeneratorMetadata dataGeneratorMetadata, Func> invoke) + { + var result = invoke(GetRequiredInstance(dataGeneratorMetadata)); + + var taskResult = await result; + if (taskResult is IEnumerable enumerable && !(taskResult is string)) + { + foreach (var item in enumerable) + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(taskResult)); + } + } + + /// Instance data member declared as ValueTask<T>. + public static async IAsyncEnumerable>> FromInstanceValueTask(DataGeneratorMetadata dataGeneratorMetadata, Func> invoke) + { + var result = invoke(GetRequiredInstance(dataGeneratorMetadata)); + + var taskResult = await result; + if (taskResult is IEnumerable enumerable && !(taskResult is string)) + { + foreach (var item in enumerable) + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(taskResult)); + } + } + + /// Instance data member declared as IAsyncEnumerable<T>. + public static async IAsyncEnumerable>> FromInstanceAsyncEnumerable(DataGeneratorMetadata dataGeneratorMetadata, Func> invoke) + { + var result = invoke(GetRequiredInstance(dataGeneratorMetadata)); + + await foreach (var item in result) + { + yield return () => Task.FromResult(DataSourceHelpers.ToObjectArray(item)); + } + } + + private static object GetRequiredInstance(DataGeneratorMetadata dataGeneratorMetadata) + { + return dataGeneratorMetadata.TestClassInstance + ?? throw new InvalidOperationException("Instance method data source requires TestClassInstance. This should have been provided by the engine."); + } +} diff --git a/TUnit.Core/TestEntryFactory.cs b/TUnit.Core/TestEntryFactory.cs new file mode 100644 index 0000000000..11bf79fffb --- /dev/null +++ b/TUnit.Core/TestEntryFactory.cs @@ -0,0 +1,74 @@ +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; + +namespace TUnit.Core; + +/// +/// Shared factory for invoked by source-generated test sources. +/// +/// +/// A single generic factory call compiles to far less IL at each generated call site than the +/// equivalent ~17-property object initializer (one call token versus a newobj plus a member +/// token per property), and the initializer body itself is JIT-compiled once here instead of +/// once per generated test class. Array parameters default to null so generated code can +/// omit them entirely when empty. +/// +#if !DEBUG +[EditorBrowsable(EditorBrowsableState.Never)] +#endif +public static class TestEntryFactory +{ + public static TestEntry Create< + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors + | DynamicallyAccessedMemberTypes.PublicProperties + | DynamicallyAccessedMemberTypes.PublicMethods)] T>( + string methodName, + string fullyQualifiedName, + string filePath, + int lineNumber, + MethodMetadata methodMetadata, + Func createInstance, + Func invokeBody, + int methodIndex, + Func createAttributes, + int attributeGroupIndex, + int startColumnNumber = 0, + int endLineNumber = 0, + int endColumnNumber = 0, + bool hasDataSource = false, + int repeatCount = 0, + string[]? categories = null, + string[]? properties = null, + string[]? dependsOn = null, + TestDependency[]? dependencies = null, + IDataSourceAttribute[]? testDataSources = null, + IDataSourceAttribute[]? classDataSources = null, + InjectableProperty[]? injectableProperties = null) where T : class + { + return new TestEntry + { + MethodName = methodName, + FullyQualifiedName = fullyQualifiedName, + FilePath = filePath, + LineNumber = lineNumber, + StartColumnNumber = startColumnNumber, + EndLineNumber = endLineNumber, + EndColumnNumber = endColumnNumber, + Categories = categories ?? [], + Properties = properties ?? [], + DependsOn = dependsOn ?? [], + Dependencies = dependencies ?? [], + HasDataSource = hasDataSource, + RepeatCount = repeatCount, + MethodMetadata = methodMetadata, + CreateInstance = createInstance, + InvokeBody = invokeBody, + MethodIndex = methodIndex, + CreateAttributes = createAttributes, + AttributeGroupIndex = attributeGroupIndex, + TestDataSources = testDataSources ?? [], + ClassDataSources = classDataSources ?? [], + InjectableProperties = injectableProperties ?? [], + }; + } +} diff --git a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet10_0.verified.txt b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet10_0.verified.txt index 2c994e0f87..d68c10b1dc 100644 --- a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet10_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet10_0.verified.txt @@ -1540,6 +1540,33 @@ namespace public new static .TestDiscoveryContext? Current { get; } public void AddTests(.<.TestContext> tests) { } } + public static class TestEntryFactory + { + public static .TestEntry Create<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T>( + string methodName, + string fullyQualifiedName, + string filePath, + int lineNumber, + .MethodMetadata methodMetadata, + <[], object?[], T> createInstance, + invokeBody, + int methodIndex, + createAttributes, + int attributeGroupIndex, + int startColumnNumber = 0, + int endLineNumber = 0, + int endColumnNumber = 0, + bool hasDataSource = false, + int repeatCount = 0, + string[]? categories = null, + string[]? properties = null, + string[]? dependsOn = null, + .TestDependency[]? dependencies = null, + .IDataSourceAttribute[]? testDataSources = null, + .IDataSourceAttribute[]? classDataSources = null, + .InjectableProperty[]? injectableProperties = null) + where T : class { } + } public readonly struct TestEntryFilterData { public required string[] Categories { get; init; } @@ -2216,6 +2243,29 @@ namespace .Helpers public static object?[] UnwrapTuple(. tuple) { } public static .<.> WrapTaskEnumerableAsObjectArrays(.<.> task) { } } + public static class DataSourceFactories + { + [.(typeof(..d__4))] + public static .<<.>> FromAsyncEnumerable(<.> invoke) { } + [.(typeof(..d__1))] + public static .<<.>> FromEnumerable( invoke) { } + [.(typeof(..d__9))] + public static .<<.>> FromInstanceAsyncEnumerable(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__6))] + public static .<<.>> FromInstanceEnumerable(.DataGeneratorMetadata dataGeneratorMetadata, invoke) { } + [.(typeof(..d__7))] + public static .<<.>> FromInstanceTask(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__5))] + public static .<<.>> FromInstanceValue(.DataGeneratorMetadata dataGeneratorMetadata, invoke) { } + [.(typeof(..d__8))] + public static .<<.>> FromInstanceValueTask(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__2))] + public static .<<.>> FromTask(<.> invoke) { } + [.(typeof(..d__0))] + public static .<<.>> FromValue( invoke) { } + [.(typeof(..d__3?))] + public static .<<.>> FromValueTask(<.> invoke) { } + } public static class DataSourceHelpers { public static <.>[] HandleTupleValue(object? value, bool shouldUnwrap) { } diff --git a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet8_0.verified.txt b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet8_0.verified.txt index 32f9dfdd4d..3f02fb3161 100644 --- a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet8_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet8_0.verified.txt @@ -1540,6 +1540,33 @@ namespace public new static .TestDiscoveryContext? Current { get; } public void AddTests(.<.TestContext> tests) { } } + public static class TestEntryFactory + { + public static .TestEntry Create<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T>( + string methodName, + string fullyQualifiedName, + string filePath, + int lineNumber, + .MethodMetadata methodMetadata, + <[], object?[], T> createInstance, + invokeBody, + int methodIndex, + createAttributes, + int attributeGroupIndex, + int startColumnNumber = 0, + int endLineNumber = 0, + int endColumnNumber = 0, + bool hasDataSource = false, + int repeatCount = 0, + string[]? categories = null, + string[]? properties = null, + string[]? dependsOn = null, + .TestDependency[]? dependencies = null, + .IDataSourceAttribute[]? testDataSources = null, + .IDataSourceAttribute[]? classDataSources = null, + .InjectableProperty[]? injectableProperties = null) + where T : class { } + } public readonly struct TestEntryFilterData { public required string[] Categories { get; init; } @@ -2216,6 +2243,29 @@ namespace .Helpers public static object?[] UnwrapTuple(. tuple) { } public static .<.> WrapTaskEnumerableAsObjectArrays(.<.> task) { } } + public static class DataSourceFactories + { + [.(typeof(..d__4))] + public static .<<.>> FromAsyncEnumerable(<.> invoke) { } + [.(typeof(..d__1))] + public static .<<.>> FromEnumerable( invoke) { } + [.(typeof(..d__9))] + public static .<<.>> FromInstanceAsyncEnumerable(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__6))] + public static .<<.>> FromInstanceEnumerable(.DataGeneratorMetadata dataGeneratorMetadata, invoke) { } + [.(typeof(..d__7))] + public static .<<.>> FromInstanceTask(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__5))] + public static .<<.>> FromInstanceValue(.DataGeneratorMetadata dataGeneratorMetadata, invoke) { } + [.(typeof(..d__8))] + public static .<<.>> FromInstanceValueTask(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__2))] + public static .<<.>> FromTask(<.> invoke) { } + [.(typeof(..d__0))] + public static .<<.>> FromValue( invoke) { } + [.(typeof(..d__3?))] + public static .<<.>> FromValueTask(<.> invoke) { } + } public static class DataSourceHelpers { public static <.>[] HandleTupleValue(object? value, bool shouldUnwrap) { } diff --git a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet9_0.verified.txt b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet9_0.verified.txt index 78903c50f7..c5e3c25db7 100644 --- a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet9_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet9_0.verified.txt @@ -1540,6 +1540,33 @@ namespace public new static .TestDiscoveryContext? Current { get; } public void AddTests(.<.TestContext> tests) { } } + public static class TestEntryFactory + { + public static .TestEntry Create<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T>( + string methodName, + string fullyQualifiedName, + string filePath, + int lineNumber, + .MethodMetadata methodMetadata, + <[], object?[], T> createInstance, + invokeBody, + int methodIndex, + createAttributes, + int attributeGroupIndex, + int startColumnNumber = 0, + int endLineNumber = 0, + int endColumnNumber = 0, + bool hasDataSource = false, + int repeatCount = 0, + string[]? categories = null, + string[]? properties = null, + string[]? dependsOn = null, + .TestDependency[]? dependencies = null, + .IDataSourceAttribute[]? testDataSources = null, + .IDataSourceAttribute[]? classDataSources = null, + .InjectableProperty[]? injectableProperties = null) + where T : class { } + } public readonly struct TestEntryFilterData { public required string[] Categories { get; init; } @@ -2216,6 +2243,29 @@ namespace .Helpers public static object?[] UnwrapTuple(. tuple) { } public static .<.> WrapTaskEnumerableAsObjectArrays(.<.> task) { } } + public static class DataSourceFactories + { + [.(typeof(..d__4))] + public static .<<.>> FromAsyncEnumerable(<.> invoke) { } + [.(typeof(..d__1))] + public static .<<.>> FromEnumerable( invoke) { } + [.(typeof(..d__9))] + public static .<<.>> FromInstanceAsyncEnumerable(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__6))] + public static .<<.>> FromInstanceEnumerable(.DataGeneratorMetadata dataGeneratorMetadata, invoke) { } + [.(typeof(..d__7))] + public static .<<.>> FromInstanceTask(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__5))] + public static .<<.>> FromInstanceValue(.DataGeneratorMetadata dataGeneratorMetadata, invoke) { } + [.(typeof(..d__8))] + public static .<<.>> FromInstanceValueTask(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__2))] + public static .<<.>> FromTask(<.> invoke) { } + [.(typeof(..d__0))] + public static .<<.>> FromValue( invoke) { } + [.(typeof(..d__3?))] + public static .<<.>> FromValueTask(<.> invoke) { } + } public static class DataSourceHelpers { public static <.>[] HandleTupleValue(object? value, bool shouldUnwrap) { } diff --git a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt index f29185fd84..537423da35 100644 --- a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt +++ b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt @@ -1482,6 +1482,33 @@ namespace public new static .TestDiscoveryContext? Current { get; } public void AddTests(.<.TestContext> tests) { } } + public static class TestEntryFactory + { + public static .TestEntry Create( + string methodName, + string fullyQualifiedName, + string filePath, + int lineNumber, + .MethodMetadata methodMetadata, + <[], object?[], T> createInstance, + invokeBody, + int methodIndex, + createAttributes, + int attributeGroupIndex, + int startColumnNumber = 0, + int endLineNumber = 0, + int endColumnNumber = 0, + bool hasDataSource = false, + int repeatCount = 0, + string[]? categories = null, + string[]? properties = null, + string[]? dependsOn = null, + .TestDependency[]? dependencies = null, + .IDataSourceAttribute[]? testDataSources = null, + .IDataSourceAttribute[]? classDataSources = null, + .InjectableProperty[]? injectableProperties = null) + where T : class { } + } public readonly struct TestEntryFilterData { public required string[] Categories { get; init; } @@ -2157,6 +2184,29 @@ namespace .Helpers public static object?[] UnwrapTuple(> tuple) { } public static .<.> WrapTaskEnumerableAsObjectArrays(.<.> task) { } } + public static class DataSourceFactories + { + [.(typeof(..d__4))] + public static .<<.>> FromAsyncEnumerable(<.> invoke) { } + [.(typeof(..d__1))] + public static .<<.>> FromEnumerable( invoke) { } + [.(typeof(..d__9))] + public static .<<.>> FromInstanceAsyncEnumerable(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__6))] + public static .<<.>> FromInstanceEnumerable(.DataGeneratorMetadata dataGeneratorMetadata, invoke) { } + [.(typeof(..d__7))] + public static .<<.>> FromInstanceTask(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__5))] + public static .<<.>> FromInstanceValue(.DataGeneratorMetadata dataGeneratorMetadata, invoke) { } + [.(typeof(..d__8))] + public static .<<.>> FromInstanceValueTask(.DataGeneratorMetadata dataGeneratorMetadata, > invoke) { } + [.(typeof(..d__2))] + public static .<<.>> FromTask(<.> invoke) { } + [.(typeof(..d__0))] + public static .<<.>> FromValue( invoke) { } + [.(typeof(..d__3?))] + public static .<<.>> FromValueTask(<.> invoke) { } + } public static class DataSourceHelpers { public static <.>[] HandleTupleValue(object? value, bool shouldUnwrap) { }