diff --git a/.github/actions/execute-pipeline/action.yml b/.github/actions/execute-pipeline/action.yml index b244a7a463..55e4893bc4 100644 --- a/.github/actions/execute-pipeline/action.yml +++ b/.github/actions/execute-pipeline/action.yml @@ -20,6 +20,10 @@ inputs: description: 'Environment' required: false default: 'Development' + netversion: + description: 'Net version' + required: false + default: 'net9.0' runs: using: "composite" @@ -33,4 +37,5 @@ runs: GITHUB_TOKEN: ${{ github.token }} DOTNET_ENVIRONMENT: ${{ inputs.environment }} NuGet__ApiKey: ${{ inputs.nuget-apikey }} - NuGet__ShouldPublish: ${{ inputs.publish-packages }} \ No newline at end of file + NuGet__ShouldPublish: ${{ inputs.publish-packages }} + NET_VERSION: ${{ inputs.netversion }} \ No newline at end of file diff --git a/.github/workflows/dotnet-framework.yml b/.github/workflows/dotnet-framework.yml new file mode 100644 index 0000000000..91d971fee9 --- /dev/null +++ b/.github/workflows/dotnet-framework.yml @@ -0,0 +1,34 @@ +name: .NET Framework + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + modularpipeline-netframework: + environment: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Pull Requests' }} + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET 9 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Setup .NET Framework + uses: microsoft/setup-msbuild@v2 + + - name: Build + run: dotnet build -c Release -p:TreatWarningsAsErrors=true + + - name: Run Pipeline + uses: ./.github/actions/execute-pipeline + with: + environment: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Development' }} + netversion: 'net472' diff --git a/Directory.Build.props b/Directory.Build.props index d8d4791c54..54bd0e5e57 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ net8.0 net8.0;net9.0 - + enable enable latest @@ -29,17 +29,8 @@ - - <_Parameter1>TUnit.Core - - - <_Parameter1>TUnit.Assertions - <_Parameter1>TUnit.Engine - - - <_Parameter1>TUnit <_Parameter1>TUnit.UnitTests @@ -84,5 +75,5 @@ - - \ No newline at end of file + + diff --git a/Directory.Build.targets b/Directory.Build.targets index fd312c626d..9babc689c3 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,34 +1,45 @@ + + + + netstandard2.0;net8.0;net9.0 + net472;net8.0;net9.0 + + + Exe + true + true + false + true + + + $(DefineConstants);ROSLYN4_7_OR_GREATER + true - - Exe - true - true - false - true - - - $(DefineConstants);ROSLYN4_7_OR_GREATER - true - - - - - - - - - - - - - - - - TUnit - TUnit.Engine.Framework.TestingPlatformBuilderHook - - + + + + + + + + + + + + + + TUnit + TUnit.Engine.Framework.TestingPlatformBuilderHook + + \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index 029aead905..a1662a459d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,6 @@ - @@ -27,6 +26,7 @@ + @@ -44,14 +44,16 @@ - + + + diff --git a/Polyfill.props b/Polyfill.props new file mode 100644 index 0000000000..59fe854cf9 --- /dev/null +++ b/Polyfill.props @@ -0,0 +1,13 @@ + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + \ No newline at end of file diff --git a/TUnit.Analyzers.Roslyn44/TUnit.Analyzers.Roslyn44.csproj b/TUnit.Analyzers.Roslyn44/TUnit.Analyzers.Roslyn44.csproj index 9144c8cb39..4bda774b85 100644 --- a/TUnit.Analyzers.Roslyn44/TUnit.Analyzers.Roslyn44.csproj +++ b/TUnit.Analyzers.Roslyn44/TUnit.Analyzers.Roslyn44.csproj @@ -7,7 +7,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TUnit.Analyzers.Roslyn47/TUnit.Analyzers.Roslyn47.csproj b/TUnit.Analyzers.Roslyn47/TUnit.Analyzers.Roslyn47.csproj index da216614d8..26e6cc0f3e 100644 --- a/TUnit.Analyzers.Roslyn47/TUnit.Analyzers.Roslyn47.csproj +++ b/TUnit.Analyzers.Roslyn47/TUnit.Analyzers.Roslyn47.csproj @@ -7,7 +7,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TUnit.Analyzers/TUnit.Analyzers.csproj b/TUnit.Analyzers/TUnit.Analyzers.csproj index 0d601af7ea..7dff531419 100644 --- a/TUnit.Analyzers/TUnit.Analyzers.csproj +++ b/TUnit.Analyzers/TUnit.Analyzers.csproj @@ -20,7 +20,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj b/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj index 14f99effa7..62c055fc78 100644 --- a/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj +++ b/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj @@ -1,6 +1,7 @@  + - net8.0 + true preview true false diff --git a/TUnit.Assertions.UnitTests/AsyncTaskTests.cs b/TUnit.Assertions.UnitTests/AsyncTaskTests.cs index bb76621112..7debde4644 100644 --- a/TUnit.Assertions.UnitTests/AsyncTaskTests.cs +++ b/TUnit.Assertions.UnitTests/AsyncTaskTests.cs @@ -22,13 +22,13 @@ public async Task Func_Awaited_Task_Is_Callable() [Test] public async Task Func_Awaited_ValueTask_Is_Callable() { - await TUnitAssert.That(async () => await ValueTask.FromResult("Hello")).IsNotNullOrEmpty().And.IsEqualTo("Hello"); + await TUnitAssert.That(async () => await new ValueTask(Task.FromResult("Hello"))).IsNotNullOrEmpty().And.IsEqualTo("Hello"); } [Test] public async Task ValueTask_Is_Callable() { - await TUnitAssert.That(ValueTask.FromResult("Hello")).IsNotNullOrEmpty().And.IsEqualTo("Hello"); + await TUnitAssert.That(new ValueTask(Task.FromResult("Hello"))).IsNotNullOrEmpty().And.IsEqualTo("Hello"); } [Test] @@ -52,7 +52,7 @@ public async Task Func_Throws_Awaited_Task_Is_Callable() [Test] public async Task Func_Throws_Awaited_ValueTask_Is_Callable() { - await TUnitAssert.ThrowsAsync(async () => await ValueTask.FromException(new DivideByZeroException())); + await TUnitAssert.ThrowsAsync(async () => await new ValueTask(Task.FromException(new DivideByZeroException()))); } [Test] @@ -64,6 +64,6 @@ public async Task Throws_Task_Is_Callable() [Test] public async Task Throws_ValueTask_Is_Callable() { - await TUnitAssert.ThrowsAsync(ValueTask.FromException(new DivideByZeroException())); + await TUnitAssert.ThrowsAsync(new ValueTask(Task.FromException(new DivideByZeroException()))); } } \ No newline at end of file diff --git a/TUnit.Assertions.UnitTests/DateOnlyEqualToAssertionTests.cs b/TUnit.Assertions.UnitTests/DateOnlyEqualToAssertionTests.cs index 535d269907..bea9da6934 100644 --- a/TUnit.Assertions.UnitTests/DateOnlyEqualToAssertionTests.cs +++ b/TUnit.Assertions.UnitTests/DateOnlyEqualToAssertionTests.cs @@ -1,4 +1,5 @@ -using TUnit.Assertions.Extensions; +#if NET +using TUnit.Assertions.Extensions; namespace TUnit.Assertions.UnitTests; @@ -41,4 +42,5 @@ public void EqualsTo__With_Tolerance_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(value1).IsEqualTo(value2).WithinDays(1)); } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/TUnit.Assertions.UnitTests/DecimalEqualsToAssertionTests.cs b/TUnit.Assertions.UnitTests/DecimalEqualsToAssertionTests.cs index 4b4529ae6a..bbfd79ca1b 100644 --- a/TUnit.Assertions.UnitTests/DecimalEqualsToAssertionTests.cs +++ b/TUnit.Assertions.UnitTests/DecimalEqualsToAssertionTests.cs @@ -22,6 +22,7 @@ public void Decimal_EqualsTo_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(double1).IsEqualTo(double2)); } +#if NET [Test] public async Task Decimal_EqualsTo__With_Tolerance_Success() { @@ -39,4 +40,5 @@ public void Decimal_EqualsTo__With_Tolerance_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(double1).IsEqualTo(double2).Within(0.0001)); } +#endif } \ No newline at end of file diff --git a/TUnit.Assertions.UnitTests/DoubleEqualsToAssertionTests.cs b/TUnit.Assertions.UnitTests/DoubleEqualsToAssertionTests.cs index 753b32a7ec..f352cb0529 100644 --- a/TUnit.Assertions.UnitTests/DoubleEqualsToAssertionTests.cs +++ b/TUnit.Assertions.UnitTests/DoubleEqualsToAssertionTests.cs @@ -22,6 +22,7 @@ public void Double_EqualsTo_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(double1).IsEqualTo(double2)); } +#if NET [Test] public async Task Double_EqualsTo__With_Tolerance_Success() { @@ -30,7 +31,7 @@ public async Task Double_EqualsTo__With_Tolerance_Success() await TUnitAssert.That(double1).IsEqualTo(double2).Within(0.1); } - + [Test] public void Double_EqualsTo__With_Tolerance_Failure() { @@ -39,4 +40,5 @@ public void Double_EqualsTo__With_Tolerance_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(double1).IsEqualTo(double2).Within(0.1)); } +#endif } \ No newline at end of file diff --git a/TUnit.Assertions.UnitTests/IntegerEqualsToAssertionTests.cs b/TUnit.Assertions.UnitTests/IntegerEqualsToAssertionTests.cs index 11ce40e177..bd1e27e4b6 100644 --- a/TUnit.Assertions.UnitTests/IntegerEqualsToAssertionTests.cs +++ b/TUnit.Assertions.UnitTests/IntegerEqualsToAssertionTests.cs @@ -22,6 +22,7 @@ public void Integer_EqualsTo_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(value1).IsEqualTo(value2)); } +#if NET [Test] public async Task Integer_EqualsTo__With_Tolerance_Success() { @@ -39,4 +40,5 @@ public void Integer_EqualsTo__With_Tolerance_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(value1).IsEqualTo(value2).Within(1)); } +#endif } \ No newline at end of file diff --git a/TUnit.Assertions.UnitTests/LongEqualsToAssertionTests.cs b/TUnit.Assertions.UnitTests/LongEqualsToAssertionTests.cs index 9abd92754b..b96cb7ec5d 100644 --- a/TUnit.Assertions.UnitTests/LongEqualsToAssertionTests.cs +++ b/TUnit.Assertions.UnitTests/LongEqualsToAssertionTests.cs @@ -22,6 +22,7 @@ public void Long_EqualsTo_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(value1).IsEqualTo(value2)); } +#if NET [Test] public async Task Long_EqualsTo__With_Tolerance_Success() { @@ -39,4 +40,5 @@ public void Long_EqualsTo__With_Tolerance_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(value1).IsEqualTo(value2).Within(1)); } +#endif } \ No newline at end of file diff --git a/TUnit.Assertions.UnitTests/TUnit.Assertions.UnitTests.csproj b/TUnit.Assertions.UnitTests/TUnit.Assertions.UnitTests.csproj index a728a652c4..333182931c 100644 --- a/TUnit.Assertions.UnitTests/TUnit.Assertions.UnitTests.csproj +++ b/TUnit.Assertions.UnitTests/TUnit.Assertions.UnitTests.csproj @@ -1,6 +1,7 @@  - + + true false true preview @@ -16,7 +17,13 @@ - + + + + PolyfillExtensions.cs + + \ No newline at end of file diff --git a/TUnit.Assertions.UnitTests/TimeOnlyEqualToAssertionTests.cs b/TUnit.Assertions.UnitTests/TimeOnlyEqualToAssertionTests.cs index 7ca1ab09fb..53bee93c68 100644 --- a/TUnit.Assertions.UnitTests/TimeOnlyEqualToAssertionTests.cs +++ b/TUnit.Assertions.UnitTests/TimeOnlyEqualToAssertionTests.cs @@ -1,4 +1,5 @@ -using TUnit.Assertions.Extensions; +#if NET +using TUnit.Assertions.Extensions; namespace TUnit.Assertions.UnitTests; @@ -41,4 +42,5 @@ public void EqualsTo__With_Tolerance_Failure() NUnitAssert.ThrowsAsync(async () => await TUnitAssert.That(value1).IsEqualTo(value2).Within(TimeSpan.FromSeconds(0.1))); } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/TUnit.Assertions/Assert.cs b/TUnit.Assertions/Assert.cs index 66ffd63be2..c03dfa542b 100644 --- a/TUnit.Assertions/Assert.cs +++ b/TUnit.Assertions/Assert.cs @@ -97,7 +97,7 @@ public static async Task ThrowsAsync(Type type, Func @delegate, { await @delegate(); } - catch (Exception e) when (e.GetType().IsAssignableTo(type)) + catch (Exception e) when (type.IsAssignableFrom(e.GetType())) { return e; } @@ -121,7 +121,7 @@ public static Exception Throws(Type type, Action @delegate, [CallerArgumentExpre { @delegate(); } - catch (Exception e) when (e.GetType().IsAssignableTo(type)) + catch (Exception e) when (type.IsAssignableFrom(e.GetType())) { return e; } diff --git a/TUnit.Assertions/AssertConditions/Connectors/AndAssertCondition.cs b/TUnit.Assertions/AssertConditions/Connectors/AndAssertCondition.cs index 201576c9c0..edf1a5a815 100644 --- a/TUnit.Assertions/AssertConditions/Connectors/AndAssertCondition.cs +++ b/TUnit.Assertions/AssertConditions/Connectors/AndAssertCondition.cs @@ -7,8 +7,8 @@ internal class AndAssertCondition : BaseAssertCondition public AndAssertCondition(BaseAssertCondition condition1, BaseAssertCondition condition2) { - ArgumentNullException.ThrowIfNull(condition1); - ArgumentNullException.ThrowIfNull(condition2); + Verify.ArgNotNull(condition1); + Verify.ArgNotNull(condition2); _condition1 = condition1; _condition2 = condition2; diff --git a/TUnit.Assertions/AssertConditions/Connectors/OrAssertCondition.cs b/TUnit.Assertions/AssertConditions/Connectors/OrAssertCondition.cs index 56327e7aed..84bb66f2da 100644 --- a/TUnit.Assertions/AssertConditions/Connectors/OrAssertCondition.cs +++ b/TUnit.Assertions/AssertConditions/Connectors/OrAssertCondition.cs @@ -7,8 +7,8 @@ internal class OrAssertCondition : BaseAssertCondition public OrAssertCondition(BaseAssertCondition condition1, BaseAssertCondition condition2) { - ArgumentNullException.ThrowIfNull(condition1); - ArgumentNullException.ThrowIfNull(condition2); + Verify.ArgNotNull(condition1); + Verify.ArgNotNull(condition2); _condition1 = condition1; _condition2 = condition2; diff --git a/TUnit.Assertions/AssertionBuilders/Groups/AndAssertionGroup.cs b/TUnit.Assertions/AssertionBuilders/Groups/AndAssertionGroup.cs index b15cc06949..36daf3b69c 100644 --- a/TUnit.Assertions/AssertionBuilders/Groups/AndAssertionGroup.cs +++ b/TUnit.Assertions/AssertionBuilders/Groups/AndAssertionGroup.cs @@ -43,11 +43,11 @@ private void Push(TAssertionBuilder assertionBuilder, Func invokableAssertionBuilder; - if (_assertConditions.TryPop(out var assertCondition)) + if (_assertConditions.Count > 0) { invokableAssertionBuilder = assert(assertionBuilder); var assertion2 = invokableAssertionBuilder.Assertions.Pop(); - _assertConditions.Push(new AndAssertCondition(assertCondition, assertion2)); + _assertConditions.Push(new AndAssertCondition(_assertConditions.Pop(), assertion2)); } else { diff --git a/TUnit.Assertions/AssertionBuilders/Groups/OrAssertionGroup.cs b/TUnit.Assertions/AssertionBuilders/Groups/OrAssertionGroup.cs index 1f4187a690..fd73cf5975 100644 --- a/TUnit.Assertions/AssertionBuilders/Groups/OrAssertionGroup.cs +++ b/TUnit.Assertions/AssertionBuilders/Groups/OrAssertionGroup.cs @@ -41,9 +41,9 @@ public OrAssertionGroup Or(Func> assert) { - if (_assertConditions.TryPop(out var assertCondition)) + if (_assertConditions.Count > 0) { - _assertConditions.Push(new OrAssertCondition(assertCondition, assert(assertionBuilder).Assertions.Pop())); + _assertConditions.Push(new OrAssertCondition(_assertConditions.Pop(), assert(assertionBuilder).Assertions.Pop())); } else { diff --git a/TUnit.Assertions/AssertionBuilders/Wrappers/DateOnlyEqualToAssertionBuilderWrapper.cs b/TUnit.Assertions/AssertionBuilders/Wrappers/DateOnlyEqualToAssertionBuilderWrapper.cs index 5c5027eb10..e670b8e2e4 100644 --- a/TUnit.Assertions/AssertionBuilders/Wrappers/DateOnlyEqualToAssertionBuilderWrapper.cs +++ b/TUnit.Assertions/AssertionBuilders/Wrappers/DateOnlyEqualToAssertionBuilderWrapper.cs @@ -1,4 +1,6 @@ -using System.Runtime.CompilerServices; +#if NET + +using System.Runtime.CompilerServices; using TUnit.Assertions.AssertConditions.Chronology; namespace TUnit.Assertions.AssertionBuilders.Wrappers; @@ -19,4 +21,6 @@ public DateOnlyEqualToAssertionBuilderWrapper WithinDays(int days, [CallerArgume return this; } -} \ No newline at end of file +} + +#endif diff --git a/TUnit.Assertions/AssertionBuilders/Wrappers/TimeOnlyEqualToAssertionBuilderWrapper.cs b/TUnit.Assertions/AssertionBuilders/Wrappers/TimeOnlyEqualToAssertionBuilderWrapper.cs index b3f0ab7c7c..3c58865172 100644 --- a/TUnit.Assertions/AssertionBuilders/Wrappers/TimeOnlyEqualToAssertionBuilderWrapper.cs +++ b/TUnit.Assertions/AssertionBuilders/Wrappers/TimeOnlyEqualToAssertionBuilderWrapper.cs @@ -1,4 +1,6 @@ -using System.Runtime.CompilerServices; +#if NET + +using System.Runtime.CompilerServices; using TUnit.Assertions.AssertConditions.Chronology; namespace TUnit.Assertions.AssertionBuilders.Wrappers; @@ -19,4 +21,6 @@ public TimeOnlyEqualToAssertionBuilderWrapper Within(TimeSpan tolerance, [Caller return this; } -} \ No newline at end of file +} + +#endif diff --git a/TUnit.Assertions/AssertionScope.cs b/TUnit.Assertions/AssertionScope.cs index 0055749a9f..7406ca06ad 100644 --- a/TUnit.Assertions/AssertionScope.cs +++ b/TUnit.Assertions/AssertionScope.cs @@ -52,7 +52,7 @@ public void Dispose() // In which case it should just throw itself, so we don't need to do that if (_exceptions.Count == 1) { - ExceptionDispatchInfo.Throw(_exceptions[0]); + ExceptionDispatchInfo.Capture(_exceptions[0]).Throw(); } if (_exceptions.Count > 1) diff --git a/TUnit.Assertions/Assertions/Chronology/Conditions/DateOnlyEqualsExpectedValueAssertCondition.cs b/TUnit.Assertions/Assertions/Chronology/Conditions/DateOnlyEqualsExpectedValueAssertCondition.cs index e740bbd508..a8ca314ac0 100644 --- a/TUnit.Assertions/Assertions/Chronology/Conditions/DateOnlyEqualsExpectedValueAssertCondition.cs +++ b/TUnit.Assertions/Assertions/Chronology/Conditions/DateOnlyEqualsExpectedValueAssertCondition.cs @@ -1,4 +1,6 @@ -namespace TUnit.Assertions.AssertConditions.Chronology; +#if NET + +namespace TUnit.Assertions.AssertConditions.Chronology; public class DateOnlyEqualsExpectedValueAssertCondition(DateOnly expected) : ExpectedValueAssertCondition(expected) { @@ -37,4 +39,6 @@ public void SetTolerance(int toleranceDays) { _tolerance = toleranceDays; } -} \ No newline at end of file +} + +#endif diff --git a/TUnit.Assertions/Assertions/Chronology/Conditions/TimeOnlyEqualsExpectedValueAssertCondition.cs b/TUnit.Assertions/Assertions/Chronology/Conditions/TimeOnlyEqualsExpectedValueAssertCondition.cs index 3aa93b7603..ff6c3273c8 100644 --- a/TUnit.Assertions/Assertions/Chronology/Conditions/TimeOnlyEqualsExpectedValueAssertCondition.cs +++ b/TUnit.Assertions/Assertions/Chronology/Conditions/TimeOnlyEqualsExpectedValueAssertCondition.cs @@ -1,4 +1,6 @@ -namespace TUnit.Assertions.AssertConditions.Chronology; +#if NET + +namespace TUnit.Assertions.AssertConditions.Chronology; public class TimeOnlyEqualsExpectedValueAssertCondition(TimeOnly expected) : ExpectedValueAssertCondition(expected) { @@ -37,4 +39,6 @@ public void SetTolerance(TimeSpan tolerance) { _tolerance = tolerance; } -} \ No newline at end of file +} + +#endif diff --git a/TUnit.Assertions/Assertions/Chronology/DateOnlyIsExtensions.cs b/TUnit.Assertions/Assertions/Chronology/DateOnlyIsExtensions.cs index 27735715b5..a6d8c206f6 100644 --- a/TUnit.Assertions/Assertions/Chronology/DateOnlyIsExtensions.cs +++ b/TUnit.Assertions/Assertions/Chronology/DateOnlyIsExtensions.cs @@ -1,5 +1,7 @@ #nullable disable +#if NET + using System.Runtime.CompilerServices; using TUnit.Assertions.AssertConditions; using TUnit.Assertions.AssertConditions.Chronology; @@ -49,4 +51,6 @@ public static InvokableValueAssertionBuilder IsBeforeOrEqualTo(this IV $"to be before or equal to {expected}") , [doNotPopulateThisValue]); } -} \ No newline at end of file +} + +#endif diff --git a/TUnit.Assertions/Assertions/Chronology/TimeOnlyIsExtensions.cs b/TUnit.Assertions/Assertions/Chronology/TimeOnlyIsExtensions.cs index 50489ad99d..35b46ebe9e 100644 --- a/TUnit.Assertions/Assertions/Chronology/TimeOnlyIsExtensions.cs +++ b/TUnit.Assertions/Assertions/Chronology/TimeOnlyIsExtensions.cs @@ -1,5 +1,7 @@ #nullable disable +#if NET + using System.Runtime.CompilerServices; using TUnit.Assertions.AssertConditions; using TUnit.Assertions.AssertConditions.Chronology; @@ -63,4 +65,6 @@ public static InvokableValueAssertionBuilder IsBeforeOrEqualTo(this IV $"be before or equal to {expected}") , [doNotPopulateThisValue]); } -} \ No newline at end of file +} + +#endif diff --git a/TUnit.Assertions/Assertions/Collections/Conditions/EnumerableEquivalentToExpectedValueAssertCondition.cs b/TUnit.Assertions/Assertions/Collections/Conditions/EnumerableEquivalentToExpectedValueAssertCondition.cs index d0d4c61038..3c8d612f92 100644 --- a/TUnit.Assertions/Assertions/Collections/Conditions/EnumerableEquivalentToExpectedValueAssertCondition.cs +++ b/TUnit.Assertions/Assertions/Collections/Conditions/EnumerableEquivalentToExpectedValueAssertCondition.cs @@ -9,7 +9,7 @@ public class EnumerableEquivalentToExpectedValueAssertCondition : ExpectedValueAssertCondition>(expected) where TActual : IEnumerable? { - protected override string GetExpectation() => $"to be equivalent to {(expected != null ? string.Join(',', expected) : null)}"; + protected override string GetExpectation() => $"to be equivalent to {(expected != null ? string.Join(",", expected) : null)}"; protected override AssertionResult GetResult(TActual? actualValue, IEnumerable? expectedValue) { @@ -21,8 +21,8 @@ protected override AssertionResult GetResult(TActual? actualValue, IEnumerable? orderedActual; if (collectionOrdering == CollectionOrdering.Any) { - orderedActual = actualValue?.Order(); - expectedValue = expectedValue?.Order(); + orderedActual = actualValue?.OrderBy(x => x); + expectedValue = expectedValue?.OrderBy(x => x); } else { @@ -38,7 +38,7 @@ protected override AssertionResult GetResult(TActual? actualValue, IEnumerable "it is not null") .OrFailIf( () => !orderedActual!.SequenceEqual(expectedValue!, equalityComparer), - () => $"it is {string.Join(',', orderedActual!)}" + () => $"it is {string.Join(",", orderedActual!)}" ); } } \ No newline at end of file diff --git a/TUnit.Assertions/Assertions/Collections/Conditions/EnumerableNotEquivalentToExpectedValueAssertCondition.cs b/TUnit.Assertions/Assertions/Collections/Conditions/EnumerableNotEquivalentToExpectedValueAssertCondition.cs index a3187ea554..7bf465e3a7 100644 --- a/TUnit.Assertions/Assertions/Collections/Conditions/EnumerableNotEquivalentToExpectedValueAssertCondition.cs +++ b/TUnit.Assertions/Assertions/Collections/Conditions/EnumerableNotEquivalentToExpectedValueAssertCondition.cs @@ -6,7 +6,7 @@ public class EnumerableNotEquivalentToExpectedValueAssertCondition>(expected) where TActual : IEnumerable? { - protected override string GetExpectation() => $" to be not equivalent to {(expected != null ? string.Join(',', expected) : null)}"; + protected override string GetExpectation() => $" to be not equivalent to {(expected != null ? string.Join(",", expected) : null)}"; protected override AssertionResult GetResult(TActual? actualValue, IEnumerable? expectedValue) { diff --git a/TUnit.Assertions/Assertions/Collections/DoesExtensions_Dictionary.cs b/TUnit.Assertions/Assertions/Collections/DoesExtensions_Dictionary.cs index d9029c3dcd..762b3c5708 100644 --- a/TUnit.Assertions/Assertions/Collections/DoesExtensions_Dictionary.cs +++ b/TUnit.Assertions/Assertions/Collections/DoesExtensions_Dictionary.cs @@ -16,7 +16,7 @@ public static InvokableValueAssertionBuilder ContainsKey(expected, (actual, _, _) => { - ArgumentNullException.ThrowIfNull(actual); + Verify.ArgNotNull(actual); return actual.Keys.Cast().Contains(expected, equalityComparer); }, (_, _, _) => $"The key \"{expected}\" was not found in the dictionary", @@ -30,7 +30,7 @@ public static InvokableValueAssertionBuilder ContainsValue(expected, (actual, _, _) => { - ArgumentNullException.ThrowIfNull(actual); + Verify.ArgNotNull(actual); return actual.Values.Cast().Contains(expected, equalityComparer); }, (_, _, _) => $"The value \"{expected}\" was not found in the dictionary", diff --git a/TUnit.Assertions/Assertions/Collections/DoesNotExtensions_Dictionary.cs b/TUnit.Assertions/Assertions/Collections/DoesNotExtensions_Dictionary.cs index a17017d26b..362d290f4c 100644 --- a/TUnit.Assertions/Assertions/Collections/DoesNotExtensions_Dictionary.cs +++ b/TUnit.Assertions/Assertions/Collections/DoesNotExtensions_Dictionary.cs @@ -16,7 +16,7 @@ public static InvokableValueAssertionBuilder DoesNotContainKey(expected, (actual, _, _) => { - ArgumentNullException.ThrowIfNull(actual); + Verify.ArgNotNull(actual); return !actual.Keys.Cast().Contains(expected, equalityComparer); }, (_, _, _) => $"The key \"{expected}\" was found in the dictionary", @@ -30,7 +30,7 @@ public static InvokableValueAssertionBuilder DoesNotContainValue(expected, (actual, _, _) => { - ArgumentNullException.ThrowIfNull(actual); + Verify.ArgNotNull(actual); return !actual.Values.Cast().Contains(expected, equalityComparer); }, (_, _, _) => $"The value \"{expected}\" was found in the dictionary", diff --git a/TUnit.Assertions/Assertions/Generics/Conditions/AssignableToExpectedValueAssertCondition.cs b/TUnit.Assertions/Assertions/Generics/Conditions/AssignableToExpectedValueAssertCondition.cs index 7419ab83ee..f344530839 100644 --- a/TUnit.Assertions/Assertions/Generics/Conditions/AssignableToExpectedValueAssertCondition.cs +++ b/TUnit.Assertions/Assertions/Generics/Conditions/AssignableToExpectedValueAssertCondition.cs @@ -13,6 +13,6 @@ protected override Task GetResult(TActual? actualValue, Excepti .FailIf(() => actualValue is null, () => "actual is null") .OrFailIf( - () => !actualValue!.GetType().IsAssignableTo(expectedType), + () => !expectedType.IsAssignableFrom(actualValue!.GetType()), () => $"it is {ActualValue?.GetType().Name ?? "null"}"); } \ No newline at end of file diff --git a/TUnit.Assertions/Assertions/Generics/Conditions/EqualsExpectedValueAssertCondition.cs b/TUnit.Assertions/Assertions/Generics/Conditions/EqualsExpectedValueAssertCondition.cs index bcd19f8e5f..443896c93e 100644 --- a/TUnit.Assertions/Assertions/Generics/Conditions/EqualsExpectedValueAssertCondition.cs +++ b/TUnit.Assertions/Assertions/Generics/Conditions/EqualsExpectedValueAssertCondition.cs @@ -1,4 +1,7 @@ -using TUnit.Assertions.AssertConditions; +#if !NET +#pragma warning disable CS8604 // Possible null reference argument. +#endif +using TUnit.Assertions.AssertConditions; namespace TUnit.Assertions.Assertions.Generics.Conditions; diff --git a/TUnit.Assertions/Assertions/Generics/Conditions/EquivalentToExpectedValueAssertCondition.cs b/TUnit.Assertions/Assertions/Generics/Conditions/EquivalentToExpectedValueAssertCondition.cs index 2a9c08bca7..2aa849da33 100644 --- a/TUnit.Assertions/Assertions/Generics/Conditions/EquivalentToExpectedValueAssertCondition.cs +++ b/TUnit.Assertions/Assertions/Generics/Conditions/EquivalentToExpectedValueAssertCondition.cs @@ -40,7 +40,7 @@ protected override AssertionResult GetResult(TActual? actualValue, TExpected? ex { MembersToIgnore = [.._ignoredMembers] })), - () => $"it is {string.Join(',', actualEnumerable)}"); + () => $"it is {string.Join(",", actualEnumerable)}"); } bool? isEqual = null; @@ -78,7 +78,7 @@ protected override AssertionResult GetResult(TActual? actualValue, TExpected? ex } return FailWithMessage($""" - {firstFailure.Type} {string.Join('.', firstFailure.NestedMemberNames)} did not match + {firstFailure.Type} {string.Join(".", firstFailure.NestedMemberNames)} did not match Expected: {Formatter.Format(firstFailure.Expected)} Received: {Formatter.Format(firstFailure.Actual)} """); diff --git a/TUnit.Assertions/Assertions/Generics/Conditions/NotAssignableToExpectedValueAssertCondition.cs b/TUnit.Assertions/Assertions/Generics/Conditions/NotAssignableToExpectedValueAssertCondition.cs index 3a1ed86874..dfb1cb59fd 100644 --- a/TUnit.Assertions/Assertions/Generics/Conditions/NotAssignableToExpectedValueAssertCondition.cs +++ b/TUnit.Assertions/Assertions/Generics/Conditions/NotAssignableToExpectedValueAssertCondition.cs @@ -13,6 +13,6 @@ protected override Task GetResult(TActual? actualValue, Excepti .FailIf(() => actualValue is null, () => "actual is null") .OrFailIf( - () => actualValue!.GetType().IsAssignableTo(expectedType), + () => expectedType.IsAssignableFrom(actualValue!.GetType()), () => $"it is {ActualValue?.GetType().Name ?? "null"}"); } \ No newline at end of file diff --git a/TUnit.Assertions/Assertions/Numbers/NumberIsExtensions.cs b/TUnit.Assertions/Assertions/Numbers/NumberIsExtensions.cs index d2118401e4..2f677952ad 100644 --- a/TUnit.Assertions/Assertions/Numbers/NumberIsExtensions.cs +++ b/TUnit.Assertions/Assertions/Numbers/NumberIsExtensions.cs @@ -1,5 +1,7 @@ #nullable disable +#if NET + using System.Numerics; using System.Runtime.CompilerServices; using TUnit.Assertions.AssertConditions; @@ -134,4 +136,6 @@ public static InvokableValueAssertionBuilder IsPositive( $"to be positive") , []); } -} \ No newline at end of file +} + +#endif diff --git a/TUnit.Assertions/Assertions/Numbers/NumberIsNotExtensions.cs b/TUnit.Assertions/Assertions/Numbers/NumberIsNotExtensions.cs index 5280fffb50..ba24dfeb4c 100644 --- a/TUnit.Assertions/Assertions/Numbers/NumberIsNotExtensions.cs +++ b/TUnit.Assertions/Assertions/Numbers/NumberIsNotExtensions.cs @@ -1,5 +1,7 @@ #nullable disable +#if NET + using System.Numerics; using System.Runtime.CompilerServices; using TUnit.Assertions.AssertConditions; @@ -201,4 +203,6 @@ public static InvokableValueAssertionBuilder IsNotPositive(thi $"to not be positive") , []); } -} \ No newline at end of file +} + +#endif diff --git a/TUnit.Assertions/Assertions/Strings/DoesExtensions_String.cs b/TUnit.Assertions/Assertions/Strings/DoesExtensions_String.cs index b6eebc1a3b..1f071a1b8b 100644 --- a/TUnit.Assertions/Assertions/Strings/DoesExtensions_String.cs +++ b/TUnit.Assertions/Assertions/Strings/DoesExtensions_String.cs @@ -59,7 +59,7 @@ public static InvokableValueAssertionBuilder EndsWith(this IValueSource< return valueSource.RegisterAssertion(new FuncValueAssertCondition(expected, (actual, _, _) => { - ArgumentNullException.ThrowIfNull(actual); + Verify.ArgNotNull(actual); return actual.EndsWith(expected, stringComparison); }, (actual, _, _) => $"\"{actual}\" does not end with \"{expected}\"", @@ -77,7 +77,7 @@ public static InvokableValueAssertionBuilder Matches(this IValueSource(regex, (actual, _, _) => { - ArgumentNullException.ThrowIfNull(actual); + Verify.ArgNotNull(actual); return regex.IsMatch(actual); }, (actual, _, _) => $"The regex \"{regex}\" does not match with \"{actual}\"", diff --git a/TUnit.Assertions/Assertions/Strings/DoesNotExtensions_String.cs b/TUnit.Assertions/Assertions/Strings/DoesNotExtensions_String.cs index 74e95e7ddb..28ba392f99 100644 --- a/TUnit.Assertions/Assertions/Strings/DoesNotExtensions_String.cs +++ b/TUnit.Assertions/Assertions/Strings/DoesNotExtensions_String.cs @@ -31,7 +31,7 @@ public static InvokableValueAssertionBuilder DoesNotStartWith(this IValu return valueSource.RegisterAssertion(new FuncValueAssertCondition(expected, (actual, _, _) => { - ArgumentNullException.ThrowIfNull(actual); + Verify.ArgNotNull(actual); return !actual.StartsWith(expected, stringComparison); }, (actual, _, _) => $"\"{actual}\" does start with \"{expected}\"", @@ -50,7 +50,7 @@ public static InvokableValueAssertionBuilder DoesNotEndWith(this IValueS return valueSource.RegisterAssertion(new FuncValueAssertCondition(expected, (actual, _, _) => { - ArgumentNullException.ThrowIfNull(actual); + Verify.ArgNotNull(actual); return !actual.EndsWith(expected, stringComparison); }, (actual, _, _) => $"\"{actual}\" does end with \"{expected}\"", diff --git a/TUnit.Assertions/Assertions/Throws/ThrowsOfTypeAssertCondition.cs b/TUnit.Assertions/Assertions/Throws/ThrowsOfTypeAssertCondition.cs index 011a20722e..b5d99ceb3c 100644 --- a/TUnit.Assertions/Assertions/Throws/ThrowsOfTypeAssertCondition.cs +++ b/TUnit.Assertions/Assertions/Throws/ThrowsOfTypeAssertCondition.cs @@ -13,7 +13,7 @@ protected override Task GetResult(TActual? actualValue, Excepti () => exception is null, () => "none was thrown") .OrFailIf( - () => !exception!.GetType().IsAssignableTo(typeof(TExpectedException)), + () => !typeof(TExpectedException).IsAssignableFrom(exception!.GetType()), () => $"{exception?.GetType().Name.PrependAOrAn()} was thrown" ); } \ No newline at end of file diff --git a/TUnit.Assertions/Compare.cs b/TUnit.Assertions/Compare.cs index c482c5fecb..28e2e84483 100644 --- a/TUnit.Assertions/Compare.cs +++ b/TUnit.Assertions/Compare.cs @@ -83,7 +83,7 @@ private static IEnumerable CheckEquivalent< { string?[] readOnlySpan = [..memberNames, $"[{i}]"]; - if (options.MembersToIgnore.Contains(string.Join('.', readOnlySpan))) + if (options.MembersToIgnore.Contains(string.Join(".", readOnlySpan))) { continue; } @@ -106,7 +106,7 @@ private static IEnumerable CheckEquivalent< { string?[] readOnlySpan = [..memberNames, fieldName]; - if (options.MembersToIgnore.Contains(string.Join('.', readOnlySpan))) + if (options.MembersToIgnore.Contains(string.Join(".", readOnlySpan))) { continue; } @@ -147,7 +147,7 @@ private static IEnumerable CheckEquivalent< { string?[] readOnlySpan = [..memberNames, propertyName]; - if (options.MembersToIgnore.Contains(string.Join('.', readOnlySpan))) + if (options.MembersToIgnore.Contains(string.Join(".", readOnlySpan))) { continue; } diff --git a/TUnit.Assertions/Equality/EquivalentToEqualityComparer.cs b/TUnit.Assertions/Equality/EquivalentToEqualityComparer.cs index 44f9808a7a..9175d34af5 100644 --- a/TUnit.Assertions/Equality/EquivalentToEqualityComparer.cs +++ b/TUnit.Assertions/Equality/EquivalentToEqualityComparer.cs @@ -1,4 +1,8 @@ -using System.Diagnostics.CodeAnalysis; +#if !NET +#pragma warning disable CS8767 // Nullability of type parameters in type of collection doesn't match implicitly implemented member (possibly because of nullability attributes). +#endif + +using System.Diagnostics.CodeAnalysis; namespace TUnit.Assertions.Equality; diff --git a/TUnit.Assertions/ExceptionsHelper.cs b/TUnit.Assertions/ExceptionsHelper.cs index 0e31aefd39..b3def8b13a 100644 --- a/TUnit.Assertions/ExceptionsHelper.cs +++ b/TUnit.Assertions/ExceptionsHelper.cs @@ -10,7 +10,7 @@ public static void ThrowIfAny(IReadOnlyList exceptions) { if (exceptions.Count == 1) { - ExceptionDispatchInfo.Throw(exceptions[0]); + ExceptionDispatchInfo.Capture(exceptions[0]).Throw(); } if (exceptions.Count > 1) diff --git a/TUnit.Assertions/Extensions/NumberExtensions.cs b/TUnit.Assertions/Extensions/NumberExtensions.cs index cefbb71ba9..79514260a7 100644 --- a/TUnit.Assertions/Extensions/NumberExtensions.cs +++ b/TUnit.Assertions/Extensions/NumberExtensions.cs @@ -1,4 +1,6 @@ -using System.Numerics; +#if NET + +using System.Numerics; namespace TUnit.Assertions.Extensions; @@ -9,4 +11,6 @@ public static bool IsBetween(this INumber number, INumber= 0 && number.CompareTo(max) <= 0; } -} \ No newline at end of file +} + +#endif diff --git a/TUnit.Assertions/Extensions/StringExtensions.cs b/TUnit.Assertions/Extensions/StringExtensions.cs index 10034a212b..139a7c033e 100644 --- a/TUnit.Assertions/Extensions/StringExtensions.cs +++ b/TUnit.Assertions/Extensions/StringExtensions.cs @@ -14,7 +14,9 @@ public static string GetStringOr(this string? value, string defaultValue) public static string ReplaceNewLines(this string value) { - return value.ReplaceLineEndings(" "); + return value.Replace("\r\n", " ") + .Replace("\n", " ") + .Replace("\r", " "); } public static string ShowNewLines(this string value) diff --git a/TUnit.Assertions/Helpers/Formatter.cs b/TUnit.Assertions/Helpers/Formatter.cs index df0445a0c2..399c21750a 100644 --- a/TUnit.Assertions/Helpers/Formatter.cs +++ b/TUnit.Assertions/Helpers/Formatter.cs @@ -27,8 +27,10 @@ public override string FormatValue(object? value) new SimpleFormatter(value => $"'{value}'"), new SimpleFormatter(value => $"<{value:O}>"), new SimpleFormatter(value => value.ToString("", CultureInfo.InvariantCulture)), +#if NET new SimpleFormatter(value => value.ToString("", CultureInfo.InvariantCulture)), new SimpleFormatter(value => value.ToString("", CultureInfo.InvariantCulture)), +#endif new SimpleFormatter(value => $"[{string.Join(", ", value.Cast().Select(Format))}]") ]; diff --git a/TUnit.Assertions/StringUtils.cs b/TUnit.Assertions/StringUtils.cs index 0d8a5594d8..85297a5dcc 100644 --- a/TUnit.Assertions/StringUtils.cs +++ b/TUnit.Assertions/StringUtils.cs @@ -8,17 +8,17 @@ internal static class StringUtils { return null; } - - return string.Join(string.Empty, input.Where(c=>!char.IsWhiteSpace(c))); + + return string.Join(string.Empty, input.Where(c => !char.IsWhiteSpace(c))); } - - public static string FindClosestSubstring(string? text, string? pattern, + + public static string FindClosestSubstring(string? text, string? pattern, StringComparison stringComparison, bool ignoreWhitespace, - out int differIndexOnActual, + out int differIndexOnActual, out int differIndexOnExpected) { - if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(pattern)) + if (text is not { Length: > 0 } || pattern is not { Length: > 0 }) { differIndexOnActual = -1; differIndexOnExpected = -1; @@ -27,30 +27,30 @@ public static string FindClosestSubstring(string? text, string? pattern, differIndexOnExpected = 0; differIndexOnActual = 0; - + var actualDictionary = text.Select((x, i) => (Char: x, Index: i)).ToDictionary(x => x.Index, x => x.Char); var expectedDictionary = pattern.Select((x, i) => (Char: x, Index: i)).ToDictionary(x => x.Index, x => x.Char); if (ignoreWhitespace) { - foreach (var (key, value) in actualDictionary.Where(x => char.IsWhiteSpace(x.Value))) + foreach (var (key, value) in actualDictionary.ToList().Where(x => char.IsWhiteSpace(x.Value))) { actualDictionary.Remove(key); } - foreach (var (key, value) in expectedDictionary.Where(x => char.IsWhiteSpace(x.Value))) + foreach (var (key, value) in expectedDictionary.ToList().Where(x => char.IsWhiteSpace(x.Value))) { expectedDictionary.Remove(key); } } var actualKeys = actualDictionary.Keys.ToList(); - + var matchingConsecutiveCount = 0; var c = pattern[0]; var indexes = actualDictionary.Where(tuple => tuple.Value.Equals(c)).Select(x => x.Key).ToArray(); - + foreach (var index in indexes) { var consecutiveCount = 0; @@ -65,20 +65,20 @@ public static string FindClosestSubstring(string? text, string? pattern, { break; } - + var actualChar = actualDictionary[actualKey.Value]; - + var expectedChar = expectedDictionary.Values.ElementAt(i); - + if (string.Equals(actualChar.ToString(), expectedChar.ToString(), stringComparison)) { consecutiveCount++; - + if (consecutiveCount > matchingConsecutiveCount) { differIndexOnExpected = expectedDictionary.Keys.ElementAt(i); differIndexOnActual = index + expectedDictionary.Keys.ElementAt(i) - expectedDictionary.Keys.ElementAt(0); - matchingConsecutiveCount = consecutiveCount; + matchingConsecutiveCount = consecutiveCount; } } else @@ -87,9 +87,9 @@ public static string FindClosestSubstring(string? text, string? pattern, } } } - - var startIndex = Math.Max(differIndexOnActual-25, 0); - + + var startIndex = Math.Max(differIndexOnActual - 25, 0); + return text.Substring(startIndex, Math.Min(text.Length - startIndex, 50)); } } \ No newline at end of file diff --git a/TUnit.Assertions/TUnit.Assertions.csproj b/TUnit.Assertions/TUnit.Assertions.csproj index a6c4135991..aa49241bdf 100644 --- a/TUnit.Assertions/TUnit.Assertions.csproj +++ b/TUnit.Assertions/TUnit.Assertions.csproj @@ -1,18 +1,17 @@  + true preview - - + + - - - + + + @@ -20,16 +19,25 @@ + + + + + true buildTransitive/$(TargetFramework)/ - + true buildTransitive/$(TargetFramework)/ + + + + diff --git a/TUnit.Core.SourceGenerator.Roslyn44/TUnit.Core.SourceGenerator.Roslyn44.csproj b/TUnit.Core.SourceGenerator.Roslyn44/TUnit.Core.SourceGenerator.Roslyn44.csproj index 2770736ff2..cbbcc5cd84 100644 --- a/TUnit.Core.SourceGenerator.Roslyn44/TUnit.Core.SourceGenerator.Roslyn44.csproj +++ b/TUnit.Core.SourceGenerator.Roslyn44/TUnit.Core.SourceGenerator.Roslyn44.csproj @@ -7,7 +7,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TUnit.Core.SourceGenerator.Roslyn47/TUnit.Core.SourceGenerator.Roslyn47.csproj b/TUnit.Core.SourceGenerator.Roslyn47/TUnit.Core.SourceGenerator.Roslyn47.csproj index 13ee9701b6..1593488f04 100644 --- a/TUnit.Core.SourceGenerator.Roslyn47/TUnit.Core.SourceGenerator.Roslyn47.csproj +++ b/TUnit.Core.SourceGenerator.Roslyn47/TUnit.Core.SourceGenerator.Roslyn47.csproj @@ -7,7 +7,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt index 49bf2db425..a020c085a6 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt @@ -29,7 +29,7 @@ file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); - var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), "AssertClassName", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -75,7 +75,7 @@ file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenera { TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), "AssertClassName", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "AssertClassName", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt index d85e2235e4..1e012bce0b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt @@ -29,7 +29,7 @@ file partial class ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestS try { var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), "SecondTest", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -78,7 +78,7 @@ file partial class ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestS { TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest:0", TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), "SecondTest", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "SecondTest", TestFilePath = @"", @@ -121,7 +121,7 @@ file partial class Inherited_ConcreteClass2 : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), "AssertClassName", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -170,7 +170,7 @@ file partial class Inherited_ConcreteClass2 : TUnit.Core.Interfaces.SourceGenera { TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName:0", TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), "AssertClassName", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "AssertClassName", TestFilePath = @"", @@ -213,7 +213,7 @@ file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); - var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), "AssertClassName", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -259,7 +259,7 @@ file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenera { TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), "AssertClassName", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "AssertClassName", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt index ef56fb2924..178aec229b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt @@ -44,12 +44,18 @@ file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterAll1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base1), "AfterAll1", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base1.AfterAll1()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 5, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -101,10 +107,16 @@ file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterEach1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base1), "AfterEach1", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach1()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -156,12 +168,18 @@ file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterAll2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base2), "AfterAll2", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base2.AfterAll2()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 20, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -213,10 +231,16 @@ file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterEach2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base2), "AfterEach2", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach2()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -268,12 +292,18 @@ file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterAll3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base3), "AfterAll3", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base3.AfterAll3()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 35, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -325,10 +355,16 @@ file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterEach3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base3), "AfterEach3", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach3()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -380,12 +416,18 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IC [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "AfterAllCleanUp", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 50, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -437,12 +479,18 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IC [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 56, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -494,12 +542,18 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IC [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 62, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -551,12 +605,18 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IC [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 68, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -608,10 +668,16 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IT [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "Cleanup", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -663,10 +729,19 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IT [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -718,10 +793,16 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IT [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -773,10 +854,19 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IT [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt index ef56fb2924..178aec229b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt @@ -44,12 +44,18 @@ file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterAll1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base1), "AfterAll1", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base1.AfterAll1()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 5, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -101,10 +107,16 @@ file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base1).GetMethod("AfterEach1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base1), "AfterEach1", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach1()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -156,12 +168,18 @@ file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterAll2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base2), "AfterAll2", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base2.AfterAll2()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 20, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -213,10 +231,16 @@ file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base2).GetMethod("AfterEach2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base2), "AfterEach2", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach2()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -268,12 +292,18 @@ file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterAll3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base3), "AfterAll3", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.Base3.AfterAll3()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 35, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -325,10 +355,16 @@ file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.Base3).GetMethod("AfterEach3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.Base3), "AfterEach3", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach3()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -380,12 +416,18 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IC [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "AfterAllCleanUp", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 50, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -437,12 +479,18 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IC [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 56, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -494,12 +542,18 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IC [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUp(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 62, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -551,12 +605,18 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IC [ new AfterClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.CleanupTests.AfterAllCleanUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 68, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -608,10 +668,16 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IT [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "Cleanup", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -663,10 +729,19 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IT [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -718,10 +793,16 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IT [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -773,10 +854,19 @@ file partial class Hooks_CleanupTests : TUnit.Core.Interfaces.SourceGenerator.IT [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.CleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), "CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt index 356e64ab79..9999dfbc6d 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt @@ -44,12 +44,18 @@ file partial class Hooks_AssemblyBase1 : TUnit.Core.Interfaces.SourceGenerator.I [ new AfterAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1).GetMethod("AfterAll1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1), "AfterAll1", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyBase1.AfterAll1()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 5, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -101,10 +107,16 @@ file partial class Hooks_AssemblyBase1 : TUnit.Core.Interfaces.SourceGenerator.I [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1).GetMethod("AfterEach1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1), "AfterEach1", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach1()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -156,12 +168,18 @@ file partial class Hooks_AssemblyBase2 : TUnit.Core.Interfaces.SourceGenerator.I [ new AfterAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2).GetMethod("AfterAll2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2), "AfterAll2", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyBase2.AfterAll2()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 20, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -213,10 +231,16 @@ file partial class Hooks_AssemblyBase2 : TUnit.Core.Interfaces.SourceGenerator.I [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2).GetMethod("AfterEach2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2), "AfterEach2", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach2()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -268,12 +292,18 @@ file partial class Hooks_AssemblyBase3 : TUnit.Core.Interfaces.SourceGenerator.I [ new AfterAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3).GetMethod("AfterAll3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3), "AfterAll3", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyBase3.AfterAll3()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 35, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -325,10 +355,16 @@ file partial class Hooks_AssemblyBase3 : TUnit.Core.Interfaces.SourceGenerator.I [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3).GetMethod("AfterEach3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3), "AfterEach3", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach3()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -380,12 +416,18 @@ file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGene [ new AfterAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUp", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), "AfterAllCleanUp", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUp()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 50, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -437,12 +479,18 @@ file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGene [ new AfterAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), "AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 56, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -494,12 +542,18 @@ file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGene [ new AfterAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), "AfterAllCleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUp(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 62, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -551,12 +605,18 @@ file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGene [ new AfterAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), "AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.AssemblyCleanupTests.AfterAllCleanUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 68, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -608,10 +668,16 @@ file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGene [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("Cleanup", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), "Cleanup", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -663,10 +729,19 @@ file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGene [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), "Cleanup", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Cleanup(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -718,10 +793,16 @@ file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGene [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), "CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -773,10 +854,19 @@ file partial class Hooks_AssemblyCleanupTests : TUnit.Core.Interfaces.SourceGene [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), "CleanupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanupWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt index 2352bcfd24..3110c85b91 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt @@ -38,12 +38,18 @@ file partial class Hooks_AssemblyBase1 : TUnit.Core.Interfaces.SourceGenerator.I [ new BeforeAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1).GetMethod("BeforeAll1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1), "BeforeAll1", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblyBase1.BeforeAll1()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 5, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -95,10 +101,16 @@ file partial class Hooks_AssemblyBase1 : TUnit.Core.Interfaces.SourceGenerator.I [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1).GetMethod("BeforeEach1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1), "BeforeEach1", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach1()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -150,12 +162,18 @@ file partial class Hooks_AssemblyBase2 : TUnit.Core.Interfaces.SourceGenerator.I [ new BeforeAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2).GetMethod("BeforeAll2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2), "BeforeAll2", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblyBase2.BeforeAll2()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 20, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -207,10 +225,16 @@ file partial class Hooks_AssemblyBase2 : TUnit.Core.Interfaces.SourceGenerator.I [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2).GetMethod("BeforeEach2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2), "BeforeEach2", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach2()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -262,12 +286,18 @@ file partial class Hooks_AssemblyBase3 : TUnit.Core.Interfaces.SourceGenerator.I [ new BeforeAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3).GetMethod("BeforeAll3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3), "BeforeAll3", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblyBase3.BeforeAll3()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 35, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -319,10 +349,16 @@ file partial class Hooks_AssemblyBase3 : TUnit.Core.Interfaces.SourceGenerator.I [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3).GetMethod("BeforeEach3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3), "BeforeEach3", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach3()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -374,12 +410,18 @@ file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenera [ new BeforeAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUp", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), "BeforeAllSetUp", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUp()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 50, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -431,12 +473,18 @@ file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenera [ new BeforeAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), "BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 56, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -488,12 +536,18 @@ file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenera [ new BeforeAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), "BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUp(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 62, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -545,12 +599,18 @@ file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenera [ new BeforeAssemblyHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), "BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.AssemblySetupTests.BeforeAllSetUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 68, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Assembly) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -602,10 +662,16 @@ file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenera [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("Setup", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), "Setup", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -657,10 +723,19 @@ file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenera [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("Setup", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), "Setup", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -712,10 +787,16 @@ file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenera [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), "SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -767,10 +848,19 @@ file partial class Hooks_AssemblySetupTests : TUnit.Core.Interfaces.SourceGenera [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), "SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.verified.txt index 9f5922b241..0e13e51696 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class BasicTests : TUnit.Core.Interfaces.SourceGenerator.ITestSourc try { var testClassType = typeof(global::TUnit.TestProject.BasicTests); - var methodInfo = typeof(global::TUnit.TestProject.BasicTests).GetMethod("SynchronousTest", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BasicTests), "SynchronousTest", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -72,7 +72,7 @@ file partial class BasicTests : TUnit.Core.Interfaces.SourceGenerator.ITestSourc { TestId = $"TUnit.TestProject.BasicTests.SynchronousTest:0", TestClass = typeof(global::TUnit.TestProject.BasicTests), - ReturnType = typeof(global::TUnit.TestProject.BasicTests).GetMethod("SynchronousTest", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BasicTests), "SynchronousTest", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "SynchronousTest", TestFilePath = @"", @@ -115,7 +115,7 @@ file partial class BasicTests : TUnit.Core.Interfaces.SourceGenerator.ITestSourc try { var testClassType = typeof(global::TUnit.TestProject.BasicTests); - var methodInfo = typeof(global::TUnit.TestProject.BasicTests).GetMethod("AsynchronousTest", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BasicTests), "AsynchronousTest", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -158,7 +158,7 @@ file partial class BasicTests : TUnit.Core.Interfaces.SourceGenerator.ITestSourc { TestId = $"TUnit.TestProject.BasicTests.AsynchronousTest:0", TestClass = typeof(global::TUnit.TestProject.BasicTests), - ReturnType = typeof(global::TUnit.TestProject.BasicTests).GetMethod("AsynchronousTest", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BasicTests), "AsynchronousTest", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "AsynchronousTest", TestFilePath = @"", @@ -201,7 +201,7 @@ file partial class BasicTests : TUnit.Core.Interfaces.SourceGenerator.ITestSourc try { var testClassType = typeof(global::TUnit.TestProject.BasicTests); - var methodInfo = typeof(global::TUnit.TestProject.BasicTests).GetMethod("ValueTaskAsynchronousTest", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BasicTests), "ValueTaskAsynchronousTest", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -244,7 +244,7 @@ file partial class BasicTests : TUnit.Core.Interfaces.SourceGenerator.ITestSourc { TestId = $"TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest:0", TestClass = typeof(global::TUnit.TestProject.BasicTests), - ReturnType = typeof(global::TUnit.TestProject.BasicTests).GetMethod("ValueTaskAsynchronousTest", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BasicTests), "ValueTaskAsynchronousTest", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "ValueTaskAsynchronousTest", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt index ee4093c9d9..36dcca6013 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt @@ -38,12 +38,18 @@ file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeAll1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base1), "BeforeAll1", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base1.BeforeAll1()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 5, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -95,10 +101,16 @@ file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeEach1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base1), "BeforeEach1", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach1()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -150,12 +162,18 @@ file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeAll2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base2), "BeforeAll2", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base2.BeforeAll2()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 20, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -207,10 +225,16 @@ file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeEach2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base2), "BeforeEach2", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach2()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -262,12 +286,18 @@ file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeAll3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base3), "BeforeAll3", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base3.BeforeAll3()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 35, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -319,10 +349,16 @@ file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeEach3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base3), "BeforeEach3", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach3()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -374,12 +410,18 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ICla [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "BeforeAllSetUp", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 50, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -431,12 +473,18 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ICla [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 56, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -488,12 +536,18 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ICla [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 62, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -545,12 +599,18 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ICla [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 68, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -602,10 +662,16 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITes [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "Setup", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -657,10 +723,19 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITes [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "Setup", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -712,10 +787,16 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITes [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -767,10 +848,19 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITes [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt index ee4093c9d9..36dcca6013 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt @@ -38,12 +38,18 @@ file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeAll1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base1), "BeforeAll1", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base1.BeforeAll1()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 5, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -95,10 +101,16 @@ file partial class Hooks_Base1 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base1).GetMethod("BeforeEach1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base1), "BeforeEach1", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach1()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -150,12 +162,18 @@ file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeAll2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base2), "BeforeAll2", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base2.BeforeAll2()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 20, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -207,10 +225,16 @@ file partial class Hooks_Base2 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base2).GetMethod("BeforeEach2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base2), "BeforeEach2", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach2()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -262,12 +286,18 @@ file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.IClassHoo [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeAll3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base3), "BeforeAll3", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base3.BeforeAll3()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 35, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -319,10 +349,16 @@ file partial class Hooks_Base3 : TUnit.Core.Interfaces.SourceGenerator.ITestHook [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.Base3).GetMethod("BeforeEach3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.Base3), "BeforeEach3", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach3()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -374,12 +410,18 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ICla [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "BeforeAllSetUp", 0, []), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp()), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 50, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -431,12 +473,18 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ICla [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 56, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -488,12 +536,18 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ICla [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "BeforeAllSetUp", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUp(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 62, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -545,12 +599,18 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ICla [ new BeforeClassHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.SetupTests.BeforeAllSetUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 68, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Class) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -602,10 +662,16 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITes [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "Setup", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -657,10 +723,19 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITes [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "Setup", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.Setup(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -712,10 +787,16 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITes [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -767,10 +848,19 @@ file partial class Hooks_SetupTests : TUnit.Core.Interfaces.SourceGenerator.ITes [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), "SetupWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetupWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt index b9e69887da..b58d86e94f 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt @@ -33,7 +33,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("Simple", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "Simple", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -84,7 +84,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).Simple:0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("Simple", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "Simple", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Simple", TestFilePath = @"", @@ -102,7 +102,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("Simple", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "Simple", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -153,7 +153,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).Simple:0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("Simple", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "Simple", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Simple", TestFilePath = @"", @@ -202,7 +202,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "WithMethodLevel", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -261,7 +261,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "WithMethodLevel", TestFilePath = @"", @@ -279,7 +279,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "WithMethodLevel", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -338,7 +338,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "WithMethodLevel", TestFilePath = @"", @@ -356,7 +356,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "WithMethodLevel", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -415,7 +415,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "WithMethodLevel", TestFilePath = @"", @@ -433,7 +433,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "WithMethodLevel", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -492,7 +492,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).WithMethodLevel(System.String):0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "WithMethodLevel", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "WithMethodLevel", TestFilePath = @"", @@ -541,7 +541,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "IgnoreParameters", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -600,7 +600,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "IgnoreParameters", TestFilePath = @"", @@ -618,7 +618,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "IgnoreParameters", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -677,7 +677,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "IgnoreParameters", TestFilePath = @"", @@ -695,7 +695,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "IgnoreParameters", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -754,7 +754,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "IgnoreParameters", TestFilePath = @"", @@ -772,7 +772,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe try { var testClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "IgnoreParameters", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -831,7 +831,7 @@ file partial class ClassAndMethodArgumentsTests : TUnit.Core.Interfaces.SourceGe { TestId = $"global::TUnit.Core.ArgumentsAttribute:{classDataIndex}:CL-ARGS1:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.ClassAndMethodArgumentsTests(System.String).IgnoreParameters(System.String):0", TestClass = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), "IgnoreParameters", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "IgnoreParameters", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt index 4ae457ce92..82ecb6fe7a 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt @@ -29,7 +29,7 @@ file partial class ClassConstructorTest : TUnit.Core.Interfaces.SourceGenerator. try { var testClassType = typeof(global::TUnit.TestProject.ClassConstructorTest); - var methodInfo = typeof(global::TUnit.TestProject.ClassConstructorTest).GetMethod("Test", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassConstructorTest), "Test", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -73,7 +73,7 @@ file partial class ClassConstructorTest : TUnit.Core.Interfaces.SourceGenerator. { TestId = $"global::TUnit.Core.ClassConstructorAttribute:{classDataIndex}:CL-CCA0:TUnit.TestProject.ClassConstructorTest(TUnit.TestProject.DummyReferenceTypeClass).Test:0", TestClass = typeof(global::TUnit.TestProject.ClassConstructorTest), - ReturnType = typeof(global::TUnit.TestProject.ClassConstructorTest).GetMethod("Test", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassConstructorTest), "Test", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Test", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt index 5528786ae5..736defd85d 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "DataSource_Class", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -42,7 +42,10 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -93,7 +96,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class(TUnit.TestProject.Dummy.SomeAsyncDisposableClass):0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "DataSource_Class", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)], TestName = "DataSource_Class", TestFilePath = @"", @@ -136,7 +139,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class_Generic", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "DataSource_Class_Generic", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -149,7 +152,10 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -200,7 +206,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic(TUnit.TestProject.Dummy.SomeAsyncDisposableClass):0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class_Generic", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "DataSource_Class_Generic", 0, [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.Dummy.SomeAsyncDisposableClass)], TestName = "DataSource_Class_Generic", TestFilePath = @"", @@ -243,7 +249,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_1_ClassDataSource", 0, [typeof(global::TUnit.TestProject.InitializableClass)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_1_ClassDataSource", 0, [typeof(global::TUnit.TestProject.InitializableClass)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -256,7 +262,10 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -307,7 +316,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource(TUnit.TestProject.InitializableClass):0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_1_ClassDataSource", 0, [typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_1_ClassDataSource", 0, [typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass)], TestName = "IsInitialized_With_1_ClassDataSource", TestFilePath = @"", @@ -350,7 +359,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_2_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -363,7 +372,10 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -417,7 +429,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_2_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)], TestName = "IsInitialized_With_2_ClassDataSources", TestFilePath = @"", @@ -460,7 +472,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_3_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -473,7 +485,10 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -528,7 +543,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_3_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)], TestName = "IsInitialized_With_3_ClassDataSources", TestFilePath = @"", @@ -571,7 +586,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_4_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -584,7 +599,10 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -640,7 +658,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_4_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)], TestName = "IsInitialized_With_4_ClassDataSources", TestFilePath = @"", @@ -683,7 +701,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_5_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -696,7 +714,10 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -753,7 +774,7 @@ file partial class ClassDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources(TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass,TUnit.TestProject.InitializableClass):0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), "IsInitialized_With_5_ClassDataSources", 0, [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass), typeof(global::TUnit.TestProject.InitializableClass)], TestName = "IsInitialized_With_5_ClassDataSources", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt index 6ae214cf19..d5a78e14d6 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt @@ -33,7 +33,7 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived1", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), "Base_Derived1", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -46,7 +46,10 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetCustomAttributes>(true).ElementAt(0); + var classDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -100,7 +103,7 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived1:0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived1", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), "Base_Derived1", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Base_Derived1", TestFilePath = @"", @@ -118,7 +121,7 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived1", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), "Base_Derived1", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -131,7 +134,10 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetCustomAttributes>(true).ElementAt(0); + var classDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -185,7 +191,7 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived1:0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived1", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), "Base_Derived1", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Base_Derived1", TestFilePath = @"", @@ -232,7 +238,7 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived2", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), "Base_Derived2", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -245,7 +251,10 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetCustomAttributes>(true).ElementAt(0); + var classDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -299,7 +308,7 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived2:0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived2", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), "Base_Derived2", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Base_Derived2", TestFilePath = @"", @@ -317,7 +326,7 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived2", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), "Base_Derived2", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -330,7 +339,10 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetCustomAttributes>(true).ElementAt(0); + var classDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -384,7 +396,7 @@ file partial class ClassDataSourceDrivenTests2 : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.TestProject.ClassDataSourceDrivenTests2.Base).Base_Derived2:0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetMethod("Base_Derived2", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), "Base_Derived2", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Base_Derived2", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt index 1af0060d26..9359d9de16 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt @@ -29,7 +29,7 @@ file partial class ClassDataSourceDrivenTestsSharedKeyed : TUnit.Core.Interfaces try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class", 0, [typeof(SomeAsyncDisposableClass)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), "DataSource_Class", 0, [typeof(SomeAsyncDisposableClass)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -42,7 +42,10 @@ file partial class ClassDataSourceDrivenTestsSharedKeyed : TUnit.Core.Interfaces TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.Keyed, Key = "🔑", +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -93,7 +96,7 @@ file partial class ClassDataSourceDrivenTestsSharedKeyed : TUnit.Core.Interfaces { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class(SomeAsyncDisposableClass):0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class", 0, [typeof(SomeAsyncDisposableClass)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), "DataSource_Class", 0, [typeof(SomeAsyncDisposableClass)]).ReturnType, ParameterTypeFullNames = [typeof(SomeAsyncDisposableClass)], TestName = "DataSource_Class", TestFilePath = @"", @@ -136,7 +139,7 @@ file partial class ClassDataSourceDrivenTestsSharedKeyed : TUnit.Core.Interfaces try { var testClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed); - var methodInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", 0, [typeof(SomeAsyncDisposableClass)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), "DataSource_Class_Generic", 0, [typeof(SomeAsyncDisposableClass)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -149,7 +152,10 @@ file partial class ClassDataSourceDrivenTestsSharedKeyed : TUnit.Core.Interfaces TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.Keyed, Key = "🔑", +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -200,7 +206,7 @@ file partial class ClassDataSourceDrivenTestsSharedKeyed : TUnit.Core.Interfaces { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic(SomeAsyncDisposableClass):0", TestClass = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), - ReturnType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", 0, [typeof(SomeAsyncDisposableClass)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), "DataSource_Class_Generic", 0, [typeof(SomeAsyncDisposableClass)]).ReturnType, ParameterTypeFullNames = [typeof(SomeAsyncDisposableClass)], TestName = "DataSource_Class_Generic", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt new file mode 100644 index 0000000000..5fdb8c1ce3 --- /dev/null +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt @@ -0,0 +1,396 @@ +[ +// +#pragma warning disable +using global::System.Linq; +using global::System.Reflection; +using global::TUnit.Core; +using global::TUnit.Core.Extensions; + +namespace TUnit.SourceGenerated; + +[global::System.Diagnostics.StackTraceHidden] +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +file partial class ClassTupleDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITestSource +{ + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialise() + { + SourceRegistrar.Register(new ClassTupleDataSourceDrivenTests()); + } + public global::System.Collections.Generic.IReadOnlyList CollectTests(string sessionId) + { + return + [ + ..Tests0(sessionId), + ..Tests1(sessionId), + ..Tests2(sessionId), + ..Tests3(sessionId), + ]; + } + private global::System.Collections.Generic.List Tests0(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests1(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests2(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } + private global::System.Collections.Generic.List Tests3(string sessionId) + { + global::System.Collections.Generic.List nodes = []; + var classDataIndex = 0; + var testMethodDataIndex = 0; + try + { + var testClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + + var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); + var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); + var classArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 classArg = classArgTuples.Item1; + global::System.String classArg1 = classArgTuples.Item2; + global::System.Boolean classArg2 = classArgTuples.Item3; + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg1 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + (global::System.Int32, global::System.String, global::System.Boolean) propertyArg2 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod()(); + (global::System.Int32 Number, global::System.String Word, global::System.Boolean Flag) propertyArg3 = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()(); + + var methodArgTuples = global::System.TupleExtensions.ToTuple(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod()()); + global::System.Int32 methodArg = methodArgTuples.Item1; + global::System.String methodArg1 = methodArgTuples.Item2; + global::System.Boolean methodArg2 = methodArgTuples.Item3; + var resettableClassFactoryDelegate = () => new ResettableLazy(() => + new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(classArg, classArg1, classArg2) + { + Property1 = propertyArg, + Property2 = propertyArg1, + Property3 = propertyArg2, + Property4 = propertyArg3, + } + , sessionId, testBuilderContext); + + var resettableClassFactory = resettableClassFactoryDelegate(); + + nodes.Add(new TestMetadata + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClassArguments = [classArg, classArg1, classArg2], + TestMethodArguments = [methodArg, methodArg1, methodArg2], + TestClassProperties = [propertyArg, propertyArg1, propertyArg2, propertyArg3], + CurrentRepeatAttempt = 0, + RepeatLimit = 0, + MethodInfo = methodInfo, + ResettableClassFactory = resettableClassFactory, + TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.DataSource_TupleMethod(methodArg, methodArg1, methodArg2)), + TestFilePath = @"", + TestLineNumber = 24, + TestAttributes = [ new global::TUnit.Core.TestAttribute() +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + ClassAttributes = [ new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") +{ + +}, new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") +{ + +} ], + AssemblyAttributes = [ ], + DataAttributes = [ ], + TestBuilderContext = testBuilderContext, + }); + resettableClassFactory = resettableClassFactoryDelegate(); + testBuilderContext = new(); + testBuilderContextAccessor.Current = testBuilderContext; + } + catch (global::System.Exception exception) + { + nodes.Add(new FailedInitializationTest + { + TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.ClassTupleDataSourceDrivenTests(System.Int32,System.String,System.Boolean).DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", + TestClass = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], + TestName = "DataSource_TupleMethod", + TestFilePath = @"", + TestLineNumber = 24, + Exception = exception, + }); + } + return nodes; + } +} + +] \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.cs b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.cs index 7c248318f6..4a1ab08ddc 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.cs @@ -1,4 +1,3 @@ -using TUnit.Assertions.Extensions; using TUnit.Core.SourceGenerator.CodeGenerators; namespace TUnit.Core.SourceGenerator.Tests; @@ -6,16 +5,11 @@ namespace TUnit.Core.SourceGenerator.Tests; internal class ClassTupleDataSourceDrivenTests : TestsBase { [Test] - [Arguments(0, "TupleMethod", "TupleMethod")] - [Arguments(0, "NamedTupleMethod", "TupleMethod")] - [Arguments(0, "TupleMethod", "NamedTupleMethod")] - [Arguments(0, "NamedTupleMethod", "NamedTupleMethod")] - public Task Test(int index, string classMethodName, string testMethodName) => RunTest(Path.Combine(Git.RootDirectory.FullName, + public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, "TUnit.TestProject", "ClassTupleDataSourceDrivenTests.cs"), async generatedFiles => { await Assert.That(generatedFiles.Length).IsEqualTo(1); - }); } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt index d85e2235e4..1e012bce0b 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestS try { var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), "SecondTest", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -78,7 +78,7 @@ file partial class ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestS { TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest:0", TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), "SecondTest", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "SecondTest", TestFilePath = @"", @@ -121,7 +121,7 @@ file partial class Inherited_ConcreteClass2 : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), "AssertClassName", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -170,7 +170,7 @@ file partial class Inherited_ConcreteClass2 : TUnit.Core.Interfaces.SourceGenera { TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName:0", TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), "AssertClassName", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "AssertClassName", TestFilePath = @"", @@ -213,7 +213,7 @@ file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); - var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), "AssertClassName", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -259,7 +259,7 @@ file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenera { TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), "AssertClassName", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "AssertClassName", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt index adb24e0908..38ae14d284 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("String1", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "String1", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -77,7 +77,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.String1(System.String):0", TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("String1", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "String1", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "String1", TestFilePath = @"", @@ -120,7 +120,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Int", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "Int", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -168,7 +168,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Int(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Int", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "Int", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "Int", TestFilePath = @"", @@ -211,7 +211,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Double", 0, [typeof(global::System.Double)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "Double", 0, [typeof(global::System.Double)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -259,7 +259,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Double(System.Double):0", TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Double", 0, [typeof(global::System.Double)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "Double", 0, [typeof(global::System.Double)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Double)], TestName = "Double", TestFilePath = @"", @@ -302,7 +302,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Float", 0, [typeof(global::System.Single)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "Float", 0, [typeof(global::System.Single)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -350,7 +350,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Float(System.Single):0", TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Float", 0, [typeof(global::System.Single)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "Float", 0, [typeof(global::System.Single)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Single)], TestName = "Float", TestFilePath = @"", @@ -393,7 +393,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Long", 0, [typeof(global::System.Int64)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "Long", 0, [typeof(global::System.Int64)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -441,7 +441,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.Long(System.Int64):0", TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Long", 0, [typeof(global::System.Int64)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "Long", 0, [typeof(global::System.Int64)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int64)], TestName = "Long", TestFilePath = @"", @@ -484,7 +484,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "UInt", 0, [typeof(global::System.UInt32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -532,7 +532,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.UInt(System.UInt32):0", TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "UInt", 0, [typeof(global::System.UInt32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.UInt32)], TestName = "UInt", TestFilePath = @"", @@ -575,7 +575,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var methodInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "ULong", 0, [typeof(global::System.UInt64)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -623,7 +623,7 @@ file partial class ConstantArgumentsTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.ConstantArgumentsTests.ULong(System.UInt64):0", TestClass = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - ReturnType = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.ConstantArgumentsTests), "ULong", 0, [typeof(global::System.UInt64)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.UInt64)], TestName = "ULong", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt index 44ef473cf1..84ae34a537 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class ConstantInBaseClassTests : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests); - var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), "SomeTest", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -77,7 +77,7 @@ file partial class ConstantInBaseClassTests : TUnit.Core.Interfaces.SourceGenera { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests.SomeTest(System.String):0", TestClass = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), - ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), "SomeTest", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "SomeTest", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt index eb201d5662..edc9140fb5 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class ConstantsInInterpolatedStringsTests : TUnit.Core.Interfaces.S try { var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests); - var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), "SomeTest", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -77,7 +77,7 @@ file partial class ConstantsInInterpolatedStringsTests : TUnit.Core.Interfaces.S { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests.SomeTest(System.String):0", TestClass = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), - ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), "SomeTest", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "SomeTest", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt index bc3d1ff3f6..efa0940f14 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt @@ -34,7 +34,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -88,7 +88,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method", TestFilePath = @"", @@ -106,7 +106,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -160,7 +160,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method", TestFilePath = @"", @@ -178,7 +178,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -232,7 +232,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method", TestFilePath = @"", @@ -280,7 +280,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -335,7 +335,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32,System.String):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String)], TestName = "DataSource_Method", TestFilePath = @"", @@ -353,7 +353,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -408,7 +408,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32,System.String):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String)], TestName = "DataSource_Method", TestFilePath = @"", @@ -426,7 +426,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -481,7 +481,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.DataSource_Method(System.Int32,System.String):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32), typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String)], TestName = "DataSource_Method", TestFilePath = @"", @@ -529,7 +529,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -583,7 +583,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.EnumValue(TUnit.TestProject.TestEnum):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.TestEnum)], TestName = "EnumValue", TestFilePath = @"", @@ -601,7 +601,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -655,7 +655,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.EnumValue(TUnit.TestProject.TestEnum):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.TestEnum)], TestName = "EnumValue", TestFilePath = @"", @@ -673,7 +673,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -727,7 +727,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.EnumValue(TUnit.TestProject.TestEnum):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "EnumValue", 0, [typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.TestEnum)], TestName = "EnumValue", TestFilePath = @"", @@ -770,7 +770,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "NullValue", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -818,7 +818,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.NullValue(System.String):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "NullValue", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "NullValue", TestFilePath = @"", @@ -861,7 +861,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "EmptyString", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -909,7 +909,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.EmptyString(System.String):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "EmptyString", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "EmptyString", TestFilePath = @"", @@ -952,7 +952,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "NonEmptyString", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1000,7 +1000,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.NonEmptyString(System.String):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "NonEmptyString", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "NonEmptyString", TestFilePath = @"", @@ -1048,7 +1048,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "BooleanString", 0, [typeof(global::System.Boolean?)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1102,7 +1102,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.BooleanString(System.Boolean?):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "BooleanString", 0, [typeof(global::System.Boolean?)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Boolean?)], TestName = "BooleanString", TestFilePath = @"", @@ -1120,7 +1120,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "BooleanString", 0, [typeof(global::System.Boolean?)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1174,7 +1174,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.DataDrivenTests.BooleanString(System.Boolean?):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "BooleanString", 0, [typeof(global::System.Boolean?)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Boolean?)], TestName = "BooleanString", TestFilePath = @"", @@ -1192,7 +1192,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "BooleanString", 0, [typeof(global::System.Boolean?)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1246,7 +1246,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.DataDrivenTests.BooleanString(System.Boolean?):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", 0, [typeof(global::System.Boolean?)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "BooleanString", 0, [typeof(global::System.Boolean?)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Boolean?)], TestName = "BooleanString", TestFilePath = @"", @@ -1289,7 +1289,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", 0, [typeof(global::System.Type)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "Type", 0, [typeof(global::System.Type)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1337,7 +1337,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.Type(System.Type):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", 0, [typeof(global::System.Type)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "Type", 0, [typeof(global::System.Type)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Type)], TestName = "Type", TestFilePath = @"", @@ -1380,7 +1380,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", 0, [typeof(global::System.Int32[])]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "IntegerArray", 0, [typeof(global::System.Int32[])]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1428,7 +1428,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.IntegerArray(System.Int32[]):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", 0, [typeof(global::System.Int32[])]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "IntegerArray", 0, [typeof(global::System.Int32[])]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32[])], TestName = "IntegerArray", TestFilePath = @"", @@ -1471,7 +1471,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest try { var testClassType = typeof(global::TUnit.TestProject.DataDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "IntMaxValue", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1519,7 +1519,7 @@ file partial class DataDrivenTests : TUnit.Core.Interfaces.SourceGenerator.ITest { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.DataDrivenTests.IntMaxValue(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataDrivenTests), "IntMaxValue", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "IntMaxValue", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt index 72aa8eac14..06be90d647 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt @@ -40,7 +40,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte try { var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -103,7 +103,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestFilePath = @"", @@ -121,7 +121,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte try { var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -184,7 +184,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestFilePath = @"", @@ -202,7 +202,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte try { var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -265,7 +265,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS2:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestFilePath = @"", @@ -283,7 +283,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte try { var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -346,7 +346,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestFilePath = @"", @@ -364,7 +364,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte try { var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -427,7 +427,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestFilePath = @"", @@ -445,7 +445,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte try { var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -508,7 +508,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS2:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestFilePath = @"", @@ -526,7 +526,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte try { var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -589,7 +589,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestFilePath = @"", @@ -607,7 +607,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte try { var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -670,7 +670,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS1:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestFilePath = @"", @@ -688,7 +688,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte try { var testClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -751,7 +751,7 @@ file partial class DataSourceClassCombinedWithDataSourceMethod : TUnit.Core.Inte { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS2:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(System.Int32).DataSourceClassCombinedWithDataSourceMethodTest(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - ReturnType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), "DataSourceClassCombinedWithDataSourceMethodTest", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Test.verified.txt index 562e1573c8..db21df673d 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Test.verified.txt @@ -33,7 +33,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -46,7 +46,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes>(true).ElementAt(0); + var classDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -62,7 +65,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -125,7 +131,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera { TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), - ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "GeneratedData_Method", TestFilePath = @"", @@ -143,7 +149,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -156,7 +162,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes(true).ElementAt(0); + var classDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -172,7 +181,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -235,7 +247,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera { TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), - ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "GeneratedData_Method", TestFilePath = @"", @@ -282,7 +294,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -295,7 +307,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes>(true).ElementAt(0); + var classDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -311,7 +326,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -378,7 +396,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera { TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method2(System.Int32,System.String,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), - ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], TestName = "GeneratedData_Method2", TestFilePath = @"", @@ -396,7 +414,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -409,7 +427,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes(true).ElementAt(0); + var classDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -425,7 +446,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes>(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -492,7 +516,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera { TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method2(System.Int32,System.String,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), - ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method2", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], TestName = "GeneratedData_Method2", TestFilePath = @"", @@ -539,7 +563,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -552,7 +576,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes>(true).ElementAt(0); + var classDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -568,7 +595,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -635,7 +665,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera { TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method3(System.Int32,System.String,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), - ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], TestName = "GeneratedData_Method3", TestFilePath = @"", @@ -653,7 +683,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera try { var testClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var methodInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -666,7 +696,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetCustomAttributes(true).ElementAt(0); + var classDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -682,7 +715,10 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var methodDataAttribute = methodInfo.GetCustomAttributes(true).ElementAt(0); + var methodDataAttribute = new global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute() +{ + +}; var methodArgGeneratedDataArray = methodDataAttribute.GenerateDataSources(methodArgDataGeneratorMetadata); @@ -749,7 +785,7 @@ file partial class DataSourceGeneratorTests : TUnit.Core.Interfaces.SourceGenera { TestId = $"global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{classDataIndex}:CL-GAC0:global::TUnit.TestProject.DataSourceGeneratorTests.AutoFixtureGeneratorAttribute:{testMethodDataIndex}:TL-GAC0:TUnit.TestProject.DataSourceGeneratorTests(System.Int32,System.String,System.Boolean).GeneratedData_Method3(System.Int32,System.String,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), - ReturnType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), "GeneratedData_Method3", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], TestName = "GeneratedData_Method3", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt index 6c4c098295..7137a588bb 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt @@ -34,7 +34,7 @@ file partial class EnumMemberNamesTests : TUnit.Core.Interfaces.SourceGenerator. try { var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests); - var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), "SomeTest", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -88,7 +88,7 @@ file partial class EnumMemberNamesTests : TUnit.Core.Interfaces.SourceGenerator. { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest(System.String):0", TestClass = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), - ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), "SomeTest", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "SomeTest", TestFilePath = @"", @@ -106,7 +106,7 @@ file partial class EnumMemberNamesTests : TUnit.Core.Interfaces.SourceGenerator. try { var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests); - var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), "SomeTest", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -160,7 +160,7 @@ file partial class EnumMemberNamesTests : TUnit.Core.Interfaces.SourceGenerator. { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest(System.String):0", TestClass = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), - ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), "SomeTest", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "SomeTest", TestFilePath = @"", @@ -178,7 +178,7 @@ file partial class EnumMemberNamesTests : TUnit.Core.Interfaces.SourceGenerator. try { var testClassType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests); - var methodInfo = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), "SomeTest", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -232,7 +232,7 @@ file partial class EnumMemberNamesTests : TUnit.Core.Interfaces.SourceGenerator. { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest(System.String):0", TestClass = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), - ReturnType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), "SomeTest", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "SomeTest", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt index 221e9be00e..cabad95aa0 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class EnumerableDataSourceDrivenTests : TUnit.Core.Interfaces.Sourc try { var testClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -80,7 +80,7 @@ file partial class EnumerableDataSourceDrivenTests : TUnit.Core.Interfaces.Sourc { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method", TestFilePath = @"", @@ -123,7 +123,7 @@ file partial class EnumerableDataSourceDrivenTests : TUnit.Core.Interfaces.Sourc try { var testClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method2", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), "DataSource_Method2", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -174,7 +174,7 @@ file partial class EnumerableDataSourceDrivenTests : TUnit.Core.Interfaces.Sourc { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method2", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), "DataSource_Method2", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method2", TestFilePath = @"", @@ -217,7 +217,7 @@ file partial class EnumerableDataSourceDrivenTests : TUnit.Core.Interfaces.Sourc try { var testClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), "DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -268,7 +268,7 @@ file partial class EnumerableDataSourceDrivenTests : TUnit.Core.Interfaces.Sourc { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn(TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue):0", TestClass = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), "DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)], TestName = "DataSource_WithBaseReturn", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt index 78edbd79c8..2f907407c3 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt @@ -33,7 +33,7 @@ file partial class EnumerableTupleDataSourceDrivenTests : TUnit.Core.Interfaces. try { var testClassType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -91,7 +91,7 @@ file partial class EnumerableTupleDataSourceDrivenTests : TUnit.Core.Interfaces. { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], TestName = "DataSource_TupleMethod", TestFilePath = @"", @@ -109,7 +109,7 @@ file partial class EnumerableTupleDataSourceDrivenTests : TUnit.Core.Interfaces. try { var testClassType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -167,7 +167,7 @@ file partial class EnumerableTupleDataSourceDrivenTests : TUnit.Core.Interfaces. { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS1:{testMethodDataIndex}:TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], TestName = "DataSource_TupleMethod", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt index 90b4bd1b13..e0d8179729 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt @@ -33,13 +33,7 @@ file partial class GenericMethodTests : TUnit.Core.Interfaces.SourceGenerator.IT try { var testClassType = typeof(global::TUnit.TestProject.GenericMethodTests); - var methodInfo = typeof(global::TUnit.TestProject.GenericMethodTests) - .GetMethods() - .Where(method => method.IsPublic) - .Where(method => method.Name == "AggregateBy_HasExpectedOutput") - .Where(method => method.GetParameters().Length == 6) - .Where(method => method.GetGenericArguments().Length == 3) - .First(); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.GenericMethodTests), "AggregateBy_HasExpectedOutput", 3, [typeof(global::System.Collections.Generic.IEnumerable), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Collections.Generic.IEqualityComparer), typeof(global::System.Collections.Generic.IEnumerable>)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -100,13 +94,7 @@ file partial class GenericMethodTests : TUnit.Core.Interfaces.SourceGenerator.IT { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput(System.Collections.Generic.IEnumerable,TKey System.Func(TSource),TAccumulate System.Func(TKey),TAccumulate System.Func(TAccumulate, TSource),System.Collections.Generic.IEqualityComparer,System.Collections.Generic.IEnumerable>):0", TestClass = typeof(global::TUnit.TestProject.GenericMethodTests), - ReturnType = typeof(global::TUnit.TestProject.GenericMethodTests) - .GetMethods() - .Where(method => method.IsPublic) - .Where(method => method.Name == "AggregateBy_HasExpectedOutput") - .Where(method => method.GetParameters().Length == 6) - .Where(method => method.GetGenericArguments().Length == 3) - .First().ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.GenericMethodTests), "AggregateBy_HasExpectedOutput", 3, [typeof(global::System.Collections.Generic.IEnumerable), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Collections.Generic.IEqualityComparer), typeof(global::System.Collections.Generic.IEnumerable>)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Collections.Generic.IEnumerable), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Collections.Generic.IEqualityComparer), typeof(global::System.Collections.Generic.IEnumerable>)], TestName = "AggregateBy_HasExpectedOutput", TestFilePath = @"", @@ -124,13 +112,7 @@ file partial class GenericMethodTests : TUnit.Core.Interfaces.SourceGenerator.IT try { var testClassType = typeof(global::TUnit.TestProject.GenericMethodTests); - var methodInfo = typeof(global::TUnit.TestProject.GenericMethodTests) - .GetMethods() - .Where(method => method.IsPublic) - .Where(method => method.Name == "AggregateBy_HasExpectedOutput") - .Where(method => method.GetParameters().Length == 6) - .Where(method => method.GetGenericArguments().Length == 3) - .First(); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.GenericMethodTests), "AggregateBy_HasExpectedOutput", 3, [typeof(global::System.Collections.Generic.IEnumerable), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Collections.Generic.IEqualityComparer), typeof(global::System.Collections.Generic.IEnumerable>)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -191,13 +173,7 @@ file partial class GenericMethodTests : TUnit.Core.Interfaces.SourceGenerator.IT { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS1:{testMethodDataIndex}:TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput(System.Collections.Generic.IEnumerable,TKey System.Func(TSource),TAccumulate System.Func(TKey),TAccumulate System.Func(TAccumulate, TSource),System.Collections.Generic.IEqualityComparer,System.Collections.Generic.IEnumerable>):0", TestClass = typeof(global::TUnit.TestProject.GenericMethodTests), - ReturnType = typeof(global::TUnit.TestProject.GenericMethodTests) - .GetMethods() - .Where(method => method.IsPublic) - .Where(method => method.Name == "AggregateBy_HasExpectedOutput") - .Where(method => method.GetParameters().Length == 6) - .Where(method => method.GetGenericArguments().Length == 3) - .First().ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.GenericMethodTests), "AggregateBy_HasExpectedOutput", 3, [typeof(global::System.Collections.Generic.IEnumerable), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Collections.Generic.IEqualityComparer), typeof(global::System.Collections.Generic.IEnumerable>)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Collections.Generic.IEnumerable), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Func), typeof(global::System.Collections.Generic.IEqualityComparer), typeof(global::System.Collections.Generic.IEnumerable>)], TestName = "AggregateBy_HasExpectedOutput", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt index 50c5d86997..4bf81bbb42 100644 --- a/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt @@ -44,10 +44,16 @@ file partial class Hooks_GlobalBase1 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1).GetMethod("AfterEach1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalBase1), "AfterEach1", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach1()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -99,10 +105,16 @@ file partial class Hooks_GlobalBase2 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2).GetMethod("AfterEach2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalBase2), "AfterEach2", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach2()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -154,10 +166,16 @@ file partial class Hooks_GlobalBase3 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3).GetMethod("AfterEach3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalBase3), "AfterEach3", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.AfterEach3()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -209,10 +227,16 @@ file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenera [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUp", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), "CleanUp", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanUp()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -264,10 +288,19 @@ file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenera [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), "CleanUp", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanUp(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -319,10 +352,16 @@ file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenera [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), "CleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -374,10 +413,19 @@ file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenera [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), "CleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.CleanUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -417,12 +465,18 @@ file partial class Hooks_GlobalBase1 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new AfterTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1).GetMethod("AfterAll1", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalBase1), "AfterAll1", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalBase1.AfterAll1(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 5, + MethodAttributes = [ new global::TUnit.Core.AfterEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -474,12 +528,18 @@ file partial class Hooks_GlobalBase2 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new AfterTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2).GetMethod("AfterAll2", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalBase2), "AfterAll2", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalBase2.AfterAll2(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 20, + MethodAttributes = [ new global::TUnit.Core.AfterEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -531,12 +591,18 @@ file partial class Hooks_GlobalBase3 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new AfterTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3).GetMethod("AfterAll3", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalBase3), "AfterAll3", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalBase3.AfterAll3(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 35, + MethodAttributes = [ new global::TUnit.Core.AfterEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -588,12 +654,18 @@ file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenera [ new AfterTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), "AfterAllCleanUp", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUp(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 50, + MethodAttributes = [ new global::TUnit.Core.AfterEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -645,12 +717,18 @@ file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenera [ new AfterTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUp", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), "AfterAllCleanUp", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUp(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 56, + MethodAttributes = [ new global::TUnit.Core.AfterEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -702,12 +780,18 @@ file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenera [ new AfterTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), "AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 62, + MethodAttributes = [ new global::TUnit.Core.AfterEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -759,12 +843,18 @@ file partial class Hooks_GlobalCleanUpTests : TUnit.Core.Interfaces.SourceGenera [ new AfterTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), "AfterAllCleanUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.AfterTests.GlobalCleanUpTests.AfterAllCleanUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 68, + MethodAttributes = [ new global::TUnit.Core.AfterEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt index e8bb9712ec..f1877c4606 100644 --- a/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt @@ -38,10 +38,16 @@ file partial class Hooks_GlobalBase1 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1).GetMethod("BeforeEach1", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1), "BeforeEach1", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach1()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -93,10 +99,16 @@ file partial class Hooks_GlobalBase2 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2).GetMethod("BeforeEach2", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2), "BeforeEach2", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach2()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -148,10 +160,16 @@ file partial class Hooks_GlobalBase3 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3).GetMethod("BeforeEach3", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3), "BeforeEach3", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.BeforeEach3()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -203,10 +221,16 @@ file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerato [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUp", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), "SetUp", 0, []), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetUp()), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -258,10 +282,19 @@ file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerato [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUp", 0, [typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), "SetUp", 0, [typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetUp(cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -313,10 +346,16 @@ file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerato [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), "SetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -368,10 +407,19 @@ file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerato [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), "SetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (classInstance, context, cancellationToken) => AsyncConvert.Convert(() => classInstance.SetUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.TimeoutAttribute(30_000) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -411,12 +459,18 @@ file partial class Hooks_GlobalBase1 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new BeforeTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1).GetMethod("BeforeAll1", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1), "BeforeAll1", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalBase1.BeforeAll1(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 5, + MethodAttributes = [ new global::TUnit.Core.BeforeEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -468,12 +522,18 @@ file partial class Hooks_GlobalBase2 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new BeforeTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2).GetMethod("BeforeAll2", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2), "BeforeAll2", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalBase2.BeforeAll2(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 20, + MethodAttributes = [ new global::TUnit.Core.BeforeEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -525,12 +585,18 @@ file partial class Hooks_GlobalBase3 : TUnit.Core.Interfaces.SourceGenerator.ITe [ new BeforeTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3).GetMethod("BeforeAll3", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3), "BeforeAll3", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalBase3.BeforeAll3(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 35, + MethodAttributes = [ new global::TUnit.Core.BeforeEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -582,12 +648,18 @@ file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerato [ new BeforeTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), "BeforeAllSetUp", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUp(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 50, + MethodAttributes = [ new global::TUnit.Core.BeforeEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -639,12 +711,18 @@ file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerato [ new BeforeTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUp", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), "BeforeAllSetUp", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUp(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 56, + MethodAttributes = [ new global::TUnit.Core.BeforeEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -696,12 +774,18 @@ file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerato [ new BeforeTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), "BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUpWithContext(context)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 62, + MethodAttributes = [ new global::TUnit.Core.BeforeEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -753,12 +837,18 @@ file partial class Hooks_GlobalSetUpTests : TUnit.Core.Interfaces.SourceGenerato [ new BeforeTestHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), "BeforeAllSetUpWithContext", 0, [typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken)]), AsyncBody = (context, cancellationToken) => AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.GlobalSetUpTests.BeforeAllSetUpWithContext(context, cancellationToken)), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 68, + MethodAttributes = [ new global::TUnit.Core.BeforeEveryAttribute(global::TUnit.Core.HookType.Test) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalUsings.cs b/TUnit.Core.SourceGenerator.Tests/GlobalUsings.cs index 8a7d993317..3068556312 100644 --- a/TUnit.Core.SourceGenerator.Tests/GlobalUsings.cs +++ b/TUnit.Core.SourceGenerator.Tests/GlobalUsings.cs @@ -1,3 +1,2 @@ global using Assert = TUnit.Assertions.Assert; -global using TestAttribute = TUnit.Core.TestAttribute; -global using static TUnit.Core.HookType; \ No newline at end of file +global using TestAttribute = NUnit.Framework.TestAttribute; \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt index 7b72b4f27f..53ca616b32 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.PropertySetterTests); - var methodInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetMethod("Test", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PropertySetterTests), "Test", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -37,7 +37,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I global::System.String propertyArg1 = global::TUnit.TestProject.PropertySetterTests.MethodData(); var propertyInfo2 = testClassType.GetProperty("Property3", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute2 = propertyInfo2.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute2 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var propertyArg2 = propertyDataAttribute2.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -49,7 +52,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I }).ElementAtOrDefault(0)(); var propertyInfo3 = testClassType.GetProperty("Property4", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute3 = propertyInfo3.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute3 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.PerTestSession, +}; var propertyArg3 = propertyDataAttribute3.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -61,7 +67,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I }).ElementAtOrDefault(0)(); var propertyInfo4 = testClassType.GetProperty("Property5", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute4 = propertyInfo4.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute4 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.PerClass, +}; var propertyArg4 = propertyDataAttribute4.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -73,7 +82,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I }).ElementAtOrDefault(0)(); var propertyInfo5 = testClassType.GetProperty("Property6", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute5 = propertyInfo5.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute5 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.Keyed, Key = "Key", +}; var propertyArg5 = propertyDataAttribute5.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -85,7 +97,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I }).ElementAtOrDefault(0)(); var propertyInfo6 = testClassType.GetProperty("StaticProperty", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute6 = propertyInfo6.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute6 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.PerTestSession, +}; var propertyArg6 = propertyDataAttribute6.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -124,7 +139,7 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I ResettableClassFactory = resettableClassFactory, TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test()), TestFilePath = @"", - TestLineNumber = 69, + TestLineNumber = 70, TestAttributes = [ new global::TUnit.Core.TestAttribute() { @@ -147,11 +162,11 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"TUnit.TestProject.PropertySetterTests.Test:0", TestClass = typeof(global::TUnit.TestProject.PropertySetterTests), - ReturnType = typeof(global::TUnit.TestProject.PropertySetterTests).GetMethod("Test", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PropertySetterTests), "Test", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Test", TestFilePath = @"", - TestLineNumber = 69, + TestLineNumber = 70, Exception = exception, }); } @@ -190,7 +205,7 @@ file partial class Inherited_InheritedPropertySetterTests : TUnit.Core.Interface try { var testClassType = typeof(global::TUnit.TestProject.InheritedPropertySetterTests); - var methodInfo = typeof(global::TUnit.TestProject.InheritedPropertySetterTests).GetMethod("Test", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedPropertySetterTests), "Test", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -198,7 +213,10 @@ file partial class Inherited_InheritedPropertySetterTests : TUnit.Core.Interface global::System.String propertyArg1 = global::TUnit.TestProject.InheritedPropertySetterTests.MethodData(); var propertyInfo2 = testClassType.GetProperty("Property3", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute2 = propertyInfo2.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute2 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var propertyArg2 = propertyDataAttribute2.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -210,7 +228,10 @@ file partial class Inherited_InheritedPropertySetterTests : TUnit.Core.Interface }).ElementAtOrDefault(0)(); var propertyInfo3 = testClassType.GetProperty("Property4", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute3 = propertyInfo3.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute3 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.PerTestSession, +}; var propertyArg3 = propertyDataAttribute3.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -222,7 +243,10 @@ file partial class Inherited_InheritedPropertySetterTests : TUnit.Core.Interface }).ElementAtOrDefault(0)(); var propertyInfo4 = testClassType.GetProperty("Property5", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute4 = propertyInfo4.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute4 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.PerClass, +}; var propertyArg4 = propertyDataAttribute4.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -234,7 +258,10 @@ file partial class Inherited_InheritedPropertySetterTests : TUnit.Core.Interface }).ElementAtOrDefault(0)(); var propertyInfo5 = testClassType.GetProperty("Property6", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute5 = propertyInfo5.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute5 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.Keyed, Key = "Key", +}; var propertyArg5 = propertyDataAttribute5.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -246,7 +273,10 @@ file partial class Inherited_InheritedPropertySetterTests : TUnit.Core.Interface }).ElementAtOrDefault(0)(); var propertyInfo6 = testClassType.GetProperty("StaticProperty", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute6 = propertyInfo6.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute6 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.PerTestSession, +}; var propertyArg6 = propertyDataAttribute6.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -285,7 +315,7 @@ file partial class Inherited_InheritedPropertySetterTests : TUnit.Core.Interface ResettableClassFactory = resettableClassFactory, TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test()), TestFilePath = @"", - TestLineNumber = 69, + TestLineNumber = 70, TestAttributes = [ new global::TUnit.Core.TestAttribute() { @@ -311,11 +341,11 @@ file partial class Inherited_InheritedPropertySetterTests : TUnit.Core.Interface { TestId = $"TUnit.TestProject.InheritedPropertySetterTests.Test:0", TestClass = typeof(global::TUnit.TestProject.InheritedPropertySetterTests), - ReturnType = typeof(global::TUnit.TestProject.InheritedPropertySetterTests).GetMethod("Test", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedPropertySetterTests), "Test", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Test", TestFilePath = @"", - TestLineNumber = 69, + TestLineNumber = 70, Exception = exception, }); } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt index 467866eea1..a7f85bc69e 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfac try { var testClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); - var methodInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("Test", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), "Test", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -75,7 +75,7 @@ file partial class InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfac { TestId = $"TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test:0", TestClass = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - ReturnType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("Test", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), "Test", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Test", TestFilePath = @"", @@ -118,7 +118,7 @@ file partial class InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfac try { var testClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); - var methodInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("GenericMethodDataSource", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), "GenericMethodDataSource", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -168,7 +168,7 @@ file partial class InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfac { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.InheritedTestsFromDifferentProjectTests.GenericMethodDataSource(System.String):0", TestClass = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - ReturnType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("GenericMethodDataSource", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), "GenericMethodDataSource", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "GenericMethodDataSource", TestFilePath = @"", @@ -211,7 +211,7 @@ file partial class InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfac try { var testClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); - var methodInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("NonGenericMethodDataSource", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), "NonGenericMethodDataSource", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -261,7 +261,7 @@ file partial class InheritedTestsFromDifferentProjectTests : TUnit.Core.Interfac { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource(System.String):0", TestClass = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - ReturnType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("NonGenericMethodDataSource", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), "NonGenericMethodDataSource", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "NonGenericMethodDataSource", TestFilePath = @"", @@ -304,7 +304,7 @@ file partial class Inherited_InheritedTestsFromDifferentProjectTests : TUnit.Cor try { var testClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); - var methodInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("BaseTest", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), "BaseTest", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -350,7 +350,7 @@ file partial class Inherited_InheritedTestsFromDifferentProjectTests : TUnit.Cor { TestId = $"TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTest:0", TestClass = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - ReturnType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("BaseTest", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), "BaseTest", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "BaseTest", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt index 9f65e00f06..7115d941ec 100644 --- a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt @@ -55,7 +55,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -102,7 +102,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS0:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -120,7 +120,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -167,7 +167,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS1:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -185,7 +185,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -232,7 +232,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS2:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -250,7 +250,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -297,7 +297,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS3:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -315,7 +315,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -362,7 +362,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS4:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -380,7 +380,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -427,7 +427,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS5:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -445,7 +445,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -492,7 +492,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS6:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -510,7 +510,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -557,7 +557,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS7:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -575,7 +575,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -622,7 +622,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS8:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -640,7 +640,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -687,7 +687,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS9:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -705,7 +705,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -752,7 +752,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS10:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -770,7 +770,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -817,7 +817,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS11:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -835,7 +835,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -882,7 +882,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS12:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -900,7 +900,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -947,7 +947,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS13:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -965,7 +965,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1012,7 +1012,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS14:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1030,7 +1030,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1077,7 +1077,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS15:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1095,7 +1095,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1142,7 +1142,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS16:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1160,7 +1160,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1207,7 +1207,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS17:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1225,7 +1225,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1272,7 +1272,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS18:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1290,7 +1290,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1337,7 +1337,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS19:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1355,7 +1355,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1402,7 +1402,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS20:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1420,7 +1420,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1467,7 +1467,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS21:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1485,7 +1485,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1532,7 +1532,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS22:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1550,7 +1550,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1597,7 +1597,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS23:TUnit.TestProject.MatrixTests.MatrixTest_One(System.String,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_One", 0, [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_One", TestFilePath = @"", @@ -1690,7 +1690,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1738,7 +1738,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS0:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -1756,7 +1756,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1804,7 +1804,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS1:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -1822,7 +1822,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1870,7 +1870,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS2:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -1888,7 +1888,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1936,7 +1936,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS3:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -1954,7 +1954,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2002,7 +2002,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS4:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2020,7 +2020,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2068,7 +2068,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS5:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2086,7 +2086,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2134,7 +2134,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS6:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2152,7 +2152,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2200,7 +2200,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS7:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2218,7 +2218,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2266,7 +2266,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS8:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2284,7 +2284,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2332,7 +2332,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS9:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2350,7 +2350,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2398,7 +2398,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS10:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2416,7 +2416,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2464,7 +2464,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS11:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2482,7 +2482,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2530,7 +2530,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS12:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2548,7 +2548,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2596,7 +2596,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS13:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2614,7 +2614,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2662,7 +2662,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS14:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2680,7 +2680,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2728,7 +2728,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS15:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2746,7 +2746,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2794,7 +2794,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS16:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2812,7 +2812,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2860,7 +2860,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS17:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2878,7 +2878,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2926,7 +2926,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS18:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -2944,7 +2944,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -2992,7 +2992,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS19:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3010,7 +3010,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3058,7 +3058,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS20:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3076,7 +3076,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3124,7 +3124,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS21:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3142,7 +3142,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3190,7 +3190,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS22:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3208,7 +3208,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3256,7 +3256,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS23:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3274,7 +3274,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3322,7 +3322,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS24:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3340,7 +3340,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3388,7 +3388,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS25:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3406,7 +3406,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3454,7 +3454,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS26:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3472,7 +3472,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3520,7 +3520,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS27:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3538,7 +3538,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3586,7 +3586,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS28:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3604,7 +3604,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3652,7 +3652,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS29:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3670,7 +3670,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3718,7 +3718,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS30:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3736,7 +3736,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3784,7 +3784,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS31:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3802,7 +3802,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3850,7 +3850,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS32:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3868,7 +3868,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3916,7 +3916,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS33:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -3934,7 +3934,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -3982,7 +3982,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS34:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4000,7 +4000,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4048,7 +4048,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS35:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4066,7 +4066,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4114,7 +4114,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS36:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4132,7 +4132,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4180,7 +4180,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS37:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4198,7 +4198,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4246,7 +4246,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS38:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4264,7 +4264,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4312,7 +4312,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS39:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4330,7 +4330,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4378,7 +4378,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS40:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4396,7 +4396,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4444,7 +4444,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS41:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4462,7 +4462,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4510,7 +4510,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS42:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4528,7 +4528,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4576,7 +4576,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS43:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4594,7 +4594,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4642,7 +4642,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS44:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4660,7 +4660,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4708,7 +4708,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS45:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4726,7 +4726,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4774,7 +4774,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS46:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4792,7 +4792,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4840,7 +4840,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS47:TUnit.TestProject.MatrixTests.MatrixTest_Two(System.Int32,System.Int32,System.Int32,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Two", 0, [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.Boolean)], TestName = "MatrixTest_Two", TestFilePath = @"", @@ -4889,7 +4889,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4935,7 +4935,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS0:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)], TestName = "MatrixTest_Enum", TestFilePath = @"", @@ -4953,7 +4953,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -4999,7 +4999,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS1:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)], TestName = "MatrixTest_Enum", TestFilePath = @"", @@ -5017,7 +5017,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -5063,7 +5063,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS2:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)], TestName = "MatrixTest_Enum", TestFilePath = @"", @@ -5081,7 +5081,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.MatrixTests); - var methodInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -5127,7 +5127,7 @@ file partial class MatrixTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TL-ARGS3:TUnit.TestProject.MatrixTests.MatrixTest_Enum(System.Int32,TUnit.TestProject.TestEnum):0", TestClass = typeof(global::TUnit.TestProject.MatrixTests), - ReturnType = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MatrixTests), "MatrixTest_Enum", 0, [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::TUnit.TestProject.TestEnum)], TestName = "MatrixTest_Enum", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt index 63f5554153..9bf2932304 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -76,7 +76,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method", TestFilePath = @"", @@ -119,7 +119,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method2", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -166,7 +166,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method2", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method2", TestFilePath = @"", @@ -209,7 +209,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", 0, [typeof(global::System.Action)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method_WithAction", 0, [typeof(global::System.Action)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -256,7 +256,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction(void System.Action()):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", 0, [typeof(global::System.Action)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method_WithAction", 0, [typeof(global::System.Action)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Action)], TestName = "DataSource_Method_WithAction", TestFilePath = @"", @@ -303,7 +303,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method3", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -353,7 +353,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method3", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method3", TestFilePath = @"", @@ -371,7 +371,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method3", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -421,7 +421,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method3", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method3", TestFilePath = @"", @@ -470,7 +470,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method4", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -526,7 +526,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method4", TestFilePath = @"", @@ -544,7 +544,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method4", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -600,7 +600,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method4", TestFilePath = @"", @@ -618,7 +618,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method4", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -674,7 +674,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS2:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method4", TestFilePath = @"", @@ -692,7 +692,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method4", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -748,7 +748,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS3:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_Method4", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "DataSource_Method4", TestFilePath = @"", @@ -791,7 +791,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -838,7 +838,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn(TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "DataSource_WithBaseReturn", 0, [typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)]).ReturnType, ParameterTypeFullNames = [typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)], TestName = "DataSource_WithBaseReturn", TestFilePath = @"", @@ -881,7 +881,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", 0, [typeof(global::System.String[])]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "EnumerableFuncArrayTest", 0, [typeof(global::System.String[])]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -932,7 +932,7 @@ file partial class MethodDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGen { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS0:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest(System.String[]):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", 0, [typeof(global::System.String[])]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), "EnumerableFuncArrayTest", 0, [typeof(global::System.String[])]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String[])], TestName = "EnumerableFuncArrayTest", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt index 7a3bf6c9d7..45e593d6c4 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt @@ -37,7 +37,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -102,7 +102,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "MyTest", TestFilePath = @"", @@ -120,7 +120,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -185,7 +185,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS1:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "MyTest", TestFilePath = @"", @@ -203,7 +203,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -272,7 +272,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS2:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "MyTest", TestFilePath = @"", @@ -290,7 +290,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -359,7 +359,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS3:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "MyTest", TestFilePath = @"", @@ -377,7 +377,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -446,7 +446,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS4:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "MyTest", TestFilePath = @"", @@ -464,7 +464,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core try { var testClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -533,7 +533,7 @@ file partial class MethodDataSourceDrivenWithCancellationTokenTests : TUnit.Core { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-EMDS5:{testMethodDataIndex}:TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), "MyTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "MyTest", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt index 9fccbd26a0..4367bb97a5 100644 --- a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class MultipleClassDataSourceDrivenTests : TUnit.Core.Interfaces.So try { var testClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetMethod("Test1", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), "Test1", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -42,7 +42,10 @@ file partial class MultipleClassDataSourceDrivenTests : TUnit.Core.Interfaces.So TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetCustomAttributes>(true).ElementAt(0); + var classDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = [global::TUnit.Core.SharedType.None, global::TUnit.Core.SharedType.None, global::TUnit.Core.SharedType.None, global::TUnit.Core.SharedType.None, global::TUnit.Core.SharedType.None], +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -99,7 +102,7 @@ file partial class MultipleClassDataSourceDrivenTests : TUnit.Core.Interfaces.So { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.MultipleClassDataSourceDrivenTests(TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5).Test1:0", TestClass = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetMethod("Test1", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), "Test1", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Test1", TestFilePath = @"", @@ -142,7 +145,7 @@ file partial class MultipleClassDataSourceDrivenTests : TUnit.Core.Interfaces.So try { var testClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetMethod("Test2", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), "Test2", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -155,7 +158,10 @@ file partial class MultipleClassDataSourceDrivenTests : TUnit.Core.Interfaces.So TestBuilderContext = testBuilderContextAccessor, TestSessionId = sessionId, }; - var classDataAttribute = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetCustomAttributes>(true).ElementAt(0); + var classDataAttribute = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = [global::TUnit.Core.SharedType.None, global::TUnit.Core.SharedType.None, global::TUnit.Core.SharedType.None, global::TUnit.Core.SharedType.None, global::TUnit.Core.SharedType.None], +}; var classArgGeneratedDataArray = classDataAttribute.GenerateDataSources(classArgDataGeneratorMetadata); @@ -212,7 +218,7 @@ file partial class MultipleClassDataSourceDrivenTests : TUnit.Core.Interfaces.So { TestId = $"global::TUnit.Core.ClassDataSourceAttribute:{classDataIndex}:CL-GAC0:TUnit.TestProject.MultipleClassDataSourceDrivenTests(TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4,TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5).Test2:0", TestClass = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetMethod("Test2", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), "Test2", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Test2", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt index f8e7b36f44..2e5ab4cbe7 100644 --- a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class NameOfArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NameOfArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NameOfArgumentTests).GetMethod("TestName", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NameOfArgumentTests), "TestName", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -77,7 +77,7 @@ file partial class NameOfArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NameOfArgumentTests.TestName(System.String):0", TestClass = typeof(global::TUnit.TestProject.NameOfArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NameOfArgumentTests).GetMethod("TestName", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NameOfArgumentTests), "TestName", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "TestName", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt index 16d5620d4e..0096a643de 100644 --- a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt @@ -33,7 +33,7 @@ file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGener try { var testClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", 0, [typeof(global::System.Byte?)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NullableByteArgumentTests), "Test", 0, [typeof(global::System.Byte?)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -84,7 +84,7 @@ file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGener { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NullableByteArgumentTests.Test(System.Byte?):0", TestClass = typeof(global::TUnit.TestProject.NullableByteArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", 0, [typeof(global::System.Byte?)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NullableByteArgumentTests), "Test", 0, [typeof(global::System.Byte?)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Byte?)], TestName = "Test", TestFilePath = @"", @@ -102,7 +102,7 @@ file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGener try { var testClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", 0, [typeof(global::System.Byte?)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NullableByteArgumentTests), "Test", 0, [typeof(global::System.Byte?)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -153,7 +153,7 @@ file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGener { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.NullableByteArgumentTests.Test(System.Byte?):0", TestClass = typeof(global::TUnit.TestProject.NullableByteArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", 0, [typeof(global::System.Byte?)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NullableByteArgumentTests), "Test", 0, [typeof(global::System.Byte?)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Byte?)], TestName = "Test", TestFilePath = @"", @@ -200,7 +200,7 @@ file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGener try { var testClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NullableByteArgumentTests), "Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -252,7 +252,7 @@ file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGener { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NullableByteArgumentTests.Test2(System.Byte,System.Byte?):0", TestClass = typeof(global::TUnit.TestProject.NullableByteArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NullableByteArgumentTests), "Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Byte), typeof(global::System.Byte?)], TestName = "Test2", TestFilePath = @"", @@ -270,7 +270,7 @@ file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGener try { var testClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NullableByteArgumentTests), "Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -322,7 +322,7 @@ file partial class NullableByteArgumentTests : TUnit.Core.Interfaces.SourceGener { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.NullableByteArgumentTests.Test2(System.Byte,System.Byte?):0", TestClass = typeof(global::TUnit.TestProject.NullableByteArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NullableByteArgumentTests), "Test2", 0, [typeof(global::System.Byte), typeof(global::System.Byte?)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Byte), typeof(global::System.Byte?)], TestName = "Test2", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt index 2484cbff19..8c4670a724 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Int", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -77,7 +77,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Int(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Int", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "Int", TestFilePath = @"", @@ -120,7 +120,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", 0, [typeof(global::System.Double)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Double", 0, [typeof(global::System.Double)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -168,7 +168,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Double(System.Double):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", 0, [typeof(global::System.Double)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Double", 0, [typeof(global::System.Double)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Double)], TestName = "Double", TestFilePath = @"", @@ -211,7 +211,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", 0, [typeof(global::System.Single)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Float", 0, [typeof(global::System.Single)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -259,7 +259,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Float(System.Single):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", 0, [typeof(global::System.Single)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Float", 0, [typeof(global::System.Single)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Single)], TestName = "Float", TestFilePath = @"", @@ -302,7 +302,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", 0, [typeof(global::System.Int64)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Long", 0, [typeof(global::System.Int64)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -350,7 +350,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Long(System.Int64):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", 0, [typeof(global::System.Int64)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Long", 0, [typeof(global::System.Int64)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int64)], TestName = "Long", TestFilePath = @"", @@ -393,7 +393,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "ULong", 0, [typeof(global::System.UInt64)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -441,7 +441,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.ULong(System.UInt64):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "ULong", 0, [typeof(global::System.UInt64)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.UInt64)], TestName = "ULong", TestFilePath = @"", @@ -484,7 +484,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "UInt", 0, [typeof(global::System.UInt32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -532,7 +532,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.UInt(System.UInt32):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "UInt", 0, [typeof(global::System.UInt32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.UInt32)], TestName = "UInt", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt index 2484cbff19..8c4670a724 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt @@ -29,7 +29,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", 0, [typeof(global::System.Int32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Int", 0, [typeof(global::System.Int32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -77,7 +77,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Int(System.Int32):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", 0, [typeof(global::System.Int32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Int", 0, [typeof(global::System.Int32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32)], TestName = "Int", TestFilePath = @"", @@ -120,7 +120,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", 0, [typeof(global::System.Double)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Double", 0, [typeof(global::System.Double)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -168,7 +168,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Double(System.Double):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", 0, [typeof(global::System.Double)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Double", 0, [typeof(global::System.Double)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Double)], TestName = "Double", TestFilePath = @"", @@ -211,7 +211,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", 0, [typeof(global::System.Single)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Float", 0, [typeof(global::System.Single)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -259,7 +259,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Float(System.Single):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", 0, [typeof(global::System.Single)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Float", 0, [typeof(global::System.Single)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Single)], TestName = "Float", TestFilePath = @"", @@ -302,7 +302,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", 0, [typeof(global::System.Int64)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Long", 0, [typeof(global::System.Int64)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -350,7 +350,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.Long(System.Int64):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", 0, [typeof(global::System.Int64)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "Long", 0, [typeof(global::System.Int64)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int64)], TestName = "Long", TestFilePath = @"", @@ -393,7 +393,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "ULong", 0, [typeof(global::System.UInt64)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -441,7 +441,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.ULong(System.UInt64):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", 0, [typeof(global::System.UInt64)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "ULong", 0, [typeof(global::System.UInt64)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.UInt64)], TestName = "ULong", TestFilePath = @"", @@ -484,7 +484,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "UInt", 0, [typeof(global::System.UInt32)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -532,7 +532,7 @@ file partial class NumberArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.NumberArgumentTests.UInt(System.UInt32):0", TestClass = typeof(global::TUnit.TestProject.NumberArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", 0, [typeof(global::System.UInt32)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.NumberArgumentTests), "UInt", 0, [typeof(global::System.UInt32)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.UInt32)], TestName = "UInt", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.cs b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.cs index 1fe78b4e8e..7ab7d04490 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.cs @@ -1,7 +1,4 @@ -using System.Globalization; using TUnit.Assertions.Extensions; -using TUnit.Core.Executors; -using TUnit.Core.Interfaces; using TUnit.Core.SourceGenerator.CodeGenerators; namespace TUnit.Core.SourceGenerator.Tests; @@ -18,45 +15,7 @@ public Task Test() => RunTest(Path.Combine(Git.RootDirectory.FullName, }); [Test] - [TestExecutor] + [SetCulture("de-DE")] + [SetUICulture("de-DE")] public Task TestDE() => Test(); - - public class SetCulture : GenericAbstractExecutor - { - protected override async Task ExecuteAsync(Func action) - { - var tcs = new TaskCompletionSource(); - - var thread = new Thread(() => - { - try - { - action().GetAwaiter().GetResult(); - tcs.SetResult(null); - } - catch (Exception e) - { - tcs.SetException(e); - } - }); - - var cultureInfoByIetfLanguageTag = CultureInfo.GetCultureInfoByIetfLanguageTag("de-DE"); - thread.CurrentCulture = cultureInfoByIetfLanguageTag; - thread.CurrentUICulture = cultureInfoByIetfLanguageTag; - thread.Start(); - - await tcs.Task; - } - - protected override void ExecuteSync(Action action) - { - var thread = new Thread(() => action()); - - var cultureInfoByIetfLanguageTag = CultureInfo.GetCultureInfoByIetfLanguageTag("de-DE"); - thread.CurrentCulture = cultureInfoByIetfLanguageTag; - thread.CurrentUICulture = cultureInfoByIetfLanguageTag; - thread.Start(); - thread.Join(); - } - } } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt index 991b80ae32..030ebc25b9 100644 --- a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_1", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "High_1", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -75,7 +75,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"TUnit.TestProject.PriorityFilteringTests.High_1:0", TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), - ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_1", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "High_1", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "High_1", TestFilePath = @"", @@ -118,7 +118,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_2", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "High_2", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -164,7 +164,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"TUnit.TestProject.PriorityFilteringTests.High_2:0", TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), - ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_2", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "High_2", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "High_2", TestFilePath = @"", @@ -207,7 +207,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_3", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "High_3", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -253,7 +253,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"TUnit.TestProject.PriorityFilteringTests.High_3:0", TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), - ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("High_3", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "High_3", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "High_3", TestFilePath = @"", @@ -296,7 +296,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Medium_1", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "Medium_1", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -342,7 +342,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"TUnit.TestProject.PriorityFilteringTests.Medium_1:0", TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), - ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Medium_1", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "Medium_1", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Medium_1", TestFilePath = @"", @@ -385,7 +385,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Medium_2", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "Medium_2", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -431,7 +431,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"TUnit.TestProject.PriorityFilteringTests.Medium_2:0", TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), - ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Medium_2", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "Medium_2", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Medium_2", TestFilePath = @"", @@ -474,7 +474,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato try { var testClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var methodInfo = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Low_1", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "Low_1", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -520,7 +520,7 @@ file partial class PriorityFilteringTests : TUnit.Core.Interfaces.SourceGenerato { TestId = $"TUnit.TestProject.PriorityFilteringTests.Low_1:0", TestClass = typeof(global::TUnit.TestProject.PriorityFilteringTests), - ReturnType = typeof(global::TUnit.TestProject.PriorityFilteringTests).GetMethod("Low_1", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PriorityFilteringTests), "Low_1", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Low_1", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt index 46ba9ac154..64fd0b7fd0 100644 --- a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.PropertySetterTests); - var methodInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetMethod("Test", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PropertySetterTests), "Test", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -37,7 +37,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I global::System.String propertyArg1 = global::TUnit.TestProject.PropertySetterTests.MethodData(); var propertyInfo2 = testClassType.GetProperty("Property3", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute2 = propertyInfo2.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute2 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + +}; var propertyArg2 = propertyDataAttribute2.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -49,7 +52,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I }).ElementAtOrDefault(0)(); var propertyInfo3 = testClassType.GetProperty("Property4", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute3 = propertyInfo3.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute3 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.PerTestSession, +}; var propertyArg3 = propertyDataAttribute3.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -61,7 +67,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I }).ElementAtOrDefault(0)(); var propertyInfo4 = testClassType.GetProperty("Property5", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute4 = propertyInfo4.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute4 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.PerClass, +}; var propertyArg4 = propertyDataAttribute4.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -73,7 +82,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I }).ElementAtOrDefault(0)(); var propertyInfo5 = testClassType.GetProperty("Property6", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute5 = propertyInfo5.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute5 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.Keyed, Key = "Key", +}; var propertyArg5 = propertyDataAttribute5.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -85,7 +97,10 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I }).ElementAtOrDefault(0)(); var propertyInfo6 = testClassType.GetProperty("StaticProperty", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); - var propertyDataAttribute6 = propertyInfo6.GetCustomAttributes>(true).ElementAt(0); + var propertyDataAttribute6 = new global::TUnit.Core.ClassDataSourceAttribute() +{ + Shared = global::TUnit.Core.SharedType.PerTestSession, +}; var propertyArg6 = propertyDataAttribute6.GenerateDataSources(new DataGeneratorMetadata { Type = TUnit.Core.Enums.DataGeneratorType.Property, @@ -124,7 +139,7 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I ResettableClassFactory = resettableClassFactory, TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.Test()), TestFilePath = @"", - TestLineNumber = 69, + TestLineNumber = 70, TestAttributes = [ new global::TUnit.Core.TestAttribute() { @@ -147,11 +162,11 @@ file partial class PropertySetterTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"TUnit.TestProject.PropertySetterTests.Test:0", TestClass = typeof(global::TUnit.TestProject.PropertySetterTests), - ReturnType = typeof(global::TUnit.TestProject.PropertySetterTests).GetMethod("Test", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.PropertySetterTests), "Test", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Test", TestFilePath = @"", - TestLineNumber = 69, + TestLineNumber = 70, Exception = exception, }); } diff --git a/TUnit.Core.SourceGenerator.Tests/ReferencesHelper.cs b/TUnit.Core.SourceGenerator.Tests/ReferencesHelper.cs index 0d372ca5d7..45fb3192d8 100644 --- a/TUnit.Core.SourceGenerator.Tests/ReferencesHelper.cs +++ b/TUnit.Core.SourceGenerator.Tests/ReferencesHelper.cs @@ -1,6 +1,5 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis; -using TUnit.TestProject.Library; namespace TUnit.Core.SourceGenerator.Tests; @@ -15,7 +14,7 @@ internal class ReferencesHelper // add your app/lib specifics, e.g.: MetadataReference.CreateFromFile(typeof(Attribute).Assembly.Location), MetadataReference.CreateFromFile(typeof(Assert).Assembly.Location), - MetadataReference.CreateFromFile(typeof(BaseTests).Assembly.Location), + MetadataReference.CreateFromFile("TUnit.TestProject.Library.dll"), MetadataReference.CreateFromFile("TUnit.Core.dll"), ]) .ToList(); diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt index efdf228ea3..df6f45062f 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt @@ -33,7 +33,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.RepeatTests); - var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("One", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "One", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -82,7 +82,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TUnit.TestProject.RepeatTests.One:0", TestClass = typeof(global::TUnit.TestProject.RepeatTests), - ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("One", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "One", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "One", TestFilePath = @"", @@ -100,7 +100,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.RepeatTests); - var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("One", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "One", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -149,7 +149,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TUnit.TestProject.RepeatTests.One:1", TestClass = typeof(global::TUnit.TestProject.RepeatTests), - ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("One", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "One", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "One", TestFilePath = @"", @@ -197,7 +197,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.RepeatTests); - var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Two", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -246,7 +246,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TUnit.TestProject.RepeatTests.Two:0", TestClass = typeof(global::TUnit.TestProject.RepeatTests), - ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Two", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Two", TestFilePath = @"", @@ -264,7 +264,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.RepeatTests); - var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Two", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -313,7 +313,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TUnit.TestProject.RepeatTests.Two:1", TestClass = typeof(global::TUnit.TestProject.RepeatTests), - ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Two", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Two", TestFilePath = @"", @@ -331,7 +331,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.RepeatTests); - var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Two", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -380,7 +380,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TUnit.TestProject.RepeatTests.Two:2", TestClass = typeof(global::TUnit.TestProject.RepeatTests), - ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Two", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Two", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Two", TestFilePath = @"", @@ -429,7 +429,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.RepeatTests); - var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Three", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -475,7 +475,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TUnit.TestProject.RepeatTests.Three:0", TestClass = typeof(global::TUnit.TestProject.RepeatTests), - ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Three", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Three", TestFilePath = @"", @@ -493,7 +493,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.RepeatTests); - var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Three", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -539,7 +539,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TUnit.TestProject.RepeatTests.Three:1", TestClass = typeof(global::TUnit.TestProject.RepeatTests), - ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Three", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Three", TestFilePath = @"", @@ -557,7 +557,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.RepeatTests); - var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Three", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -603,7 +603,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TUnit.TestProject.RepeatTests.Three:2", TestClass = typeof(global::TUnit.TestProject.RepeatTests), - ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Three", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Three", TestFilePath = @"", @@ -621,7 +621,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour try { var testClassType = typeof(global::TUnit.TestProject.RepeatTests); - var methodInfo = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Three", 0, []); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -667,7 +667,7 @@ file partial class RepeatTests : TUnit.Core.Interfaces.SourceGenerator.ITestSour { TestId = $"TUnit.TestProject.RepeatTests.Three:3", TestClass = typeof(global::TUnit.TestProject.RepeatTests), - ReturnType = typeof(global::TUnit.TestProject.RepeatTests).GetMethod("Three", 0, []).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.RepeatTests), "Three", 0, []).ReturnType, ParameterTypeFullNames = [], TestName = "Three", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.Test.verified.txt index b954ee6f12..b4da388f60 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadHooksTests.Test.verified.txt @@ -38,10 +38,22 @@ file partial class Hooks_STAThreadTests : TUnit.Core.Interfaces.SourceGenerator. [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.STAThreadTests).GetMethod("BeforeTest", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.STAThreadTests), "BeforeTest", 0, []), Body = (classInstance, context, cancellationToken) => classInstance.BeforeTest(), HookExecutor = new global::TUnit.Core.STAThreadExecutor(), Order = 0, + MethodAttributes = [ new global::TUnit.Core.BeforeAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.Executors.HookExecutorAttribute() +{ + +} ], + ClassAttributes = [ new global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") +{ + +} ], + AssemblyAttributes = [ ], }, ]; } @@ -99,10 +111,22 @@ file partial class Hooks_STAThreadTests : TUnit.Core.Interfaces.SourceGenerator. [ new InstanceHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.STAThreadTests).GetMethod("AfterTest", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.STAThreadTests), "AfterTest", 0, []), Body = (classInstance, context, cancellationToken) => classInstance.AfterTest(), HookExecutor = new global::TUnit.Core.STAThreadExecutor(), Order = 0, + MethodAttributes = [ new global::TUnit.Core.AfterAttribute(global::TUnit.Core.HookType.Test) +{ + +}, new global::TUnit.Core.Executors.HookExecutorAttribute() +{ + +} ], + ClassAttributes = [ new global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") +{ + +} ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt index 82487ae4d1..cbfd420a13 100644 --- a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt @@ -39,7 +39,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -111,7 +111,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Normal", TestFilePath = @"", @@ -129,7 +129,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -201,7 +201,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Normal", TestFilePath = @"", @@ -219,7 +219,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -291,7 +291,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Normal", TestFilePath = @"", @@ -309,7 +309,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -381,7 +381,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS3:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Normal", TestFilePath = @"", @@ -399,7 +399,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -471,7 +471,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS4:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Normal", TestFilePath = @"", @@ -489,7 +489,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -561,7 +561,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS5:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Normal", TestFilePath = @"", @@ -579,7 +579,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -651,7 +651,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS6:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Normal", TestFilePath = @"", @@ -669,7 +669,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -744,7 +744,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS7:TUnit.TestProject.StringArgumentTests.Normal(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Normal", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Normal", TestFilePath = @"", @@ -797,7 +797,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -866,7 +866,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Nullable", TestFilePath = @"", @@ -884,7 +884,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -953,7 +953,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS1:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Nullable", TestFilePath = @"", @@ -971,7 +971,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1040,7 +1040,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS2:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Nullable", TestFilePath = @"", @@ -1058,7 +1058,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1127,7 +1127,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS3:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Nullable", TestFilePath = @"", @@ -1145,7 +1145,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1214,7 +1214,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS4:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Nullable", TestFilePath = @"", @@ -1232,7 +1232,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1301,7 +1301,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS5:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Nullable", TestFilePath = @"", @@ -1319,7 +1319,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1388,7 +1388,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS6:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Nullable", TestFilePath = @"", @@ -1406,7 +1406,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I try { var testClassType = typeof(global::TUnit.TestProject.StringArgumentTests); - var methodInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -1475,7 +1475,7 @@ file partial class StringArgumentTests : TUnit.Core.Interfaces.SourceGenerator.I { TestId = $"global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS7:TUnit.TestProject.StringArgumentTests.Nullable(System.String):0", TestClass = typeof(global::TUnit.TestProject.StringArgumentTests), - ReturnType = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", 0, [typeof(global::System.String)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.StringArgumentTests), "Nullable", 0, [typeof(global::System.String)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.String)], TestName = "Nullable", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/TUnit.Core.SourceGenerator.Tests.csproj b/TUnit.Core.SourceGenerator.Tests/TUnit.Core.SourceGenerator.Tests.csproj index cf34c00c2c..29d617e28a 100644 --- a/TUnit.Core.SourceGenerator.Tests/TUnit.Core.SourceGenerator.Tests.csproj +++ b/TUnit.Core.SourceGenerator.Tests/TUnit.Core.SourceGenerator.Tests.csproj @@ -2,18 +2,30 @@ false - true - Exe - true - true - false - - + + - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + PreserveNewest + + + PreserveNewest + \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt index 17e4f712fd..41e945b477 100644 --- a/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TestDiscoveryHookTests.Test.verified.txt @@ -26,12 +26,18 @@ file partial class Hooks_TestDiscoveryHookTests : TUnit.Core.Interfaces.SourceGe [ new global::TUnit.Core.Hooks.BeforeTestDiscoveryHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.TestDiscoveryHookTests).GetMethod("BeforeDiscovery", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TestDiscoveryHookTests), "BeforeDiscovery", 0, []), Body = (context, cancellationToken) => global::TUnit.TestProject.TestDiscoveryHookTests.BeforeDiscovery(), HookExecutor = DefaultExecutor.Instance, Order = 5, FilePath = @"", LineNumber = 5, + MethodAttributes = [ new global::TUnit.Core.BeforeEveryAttribute(global::TUnit.Core.HookType.TestDiscovery) +{ + Order = 5, +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } @@ -77,12 +83,18 @@ file partial class Hooks_TestDiscoveryHookTests : TUnit.Core.Interfaces.SourceGe [ new global::TUnit.Core.Hooks.AfterTestDiscoveryHookMethod { - MethodInfo = typeof(global::TUnit.TestProject.TestDiscoveryHookTests).GetMethod("AfterDiscovery", 0, []), + MethodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TestDiscoveryHookTests), "AfterDiscovery", 0, []), Body = (context, cancellationToken) => global::TUnit.TestProject.TestDiscoveryHookTests.AfterDiscovery(), HookExecutor = DefaultExecutor.Instance, Order = 0, FilePath = @"", LineNumber = 10, + MethodAttributes = [ new global::TUnit.Core.AfterEveryAttribute(global::TUnit.Core.HookType.TestDiscovery) +{ + +} ], + ClassAttributes = [ ], + AssemblyAttributes = [ ], }, ]; } diff --git a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt index 43fbfe5ea3..364f9ed2d4 100644 --- a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG try { var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DefaultTest", 0, [typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "DefaultTest", 0, [typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -79,7 +79,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).DefaultTest(System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DefaultTest", 0, [typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "DefaultTest", 0, [typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Threading.CancellationToken)], TestName = "DefaultTest", TestFilePath = @"", @@ -122,7 +122,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG try { var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("BasicTest", 0, [typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "BasicTest", 0, [typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -178,7 +178,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).BasicTest(System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("BasicTest", 0, [typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "BasicTest", 0, [typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Threading.CancellationToken)], TestName = "BasicTest", TestFilePath = @"", @@ -221,7 +221,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG try { var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("InheritedTimeoutAttribute", 0, [typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "InheritedTimeoutAttribute", 0, [typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -274,7 +274,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).InheritedTimeoutAttribute(System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("InheritedTimeoutAttribute", 0, [typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "InheritedTimeoutAttribute", 0, [typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Threading.CancellationToken)], TestName = "InheritedTimeoutAttribute", TestFilePath = @"", @@ -317,7 +317,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG try { var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "DataTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -375,7 +375,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.ArgumentsAttribute:{testMethodDataIndex}:TL-ARGS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).DataTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "DataTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "DataTest", TestFilePath = @"", @@ -418,7 +418,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG try { var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataSourceTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "DataSourceTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -475,7 +475,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).DataSourceTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataSourceTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "DataSourceTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "DataSourceTest", TestFilePath = @"", @@ -523,7 +523,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG try { var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -581,7 +581,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TL-ARGS0:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).MatrixTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "MatrixTest", TestFilePath = @"", @@ -599,7 +599,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG try { var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -657,7 +657,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TL-ARGS1:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).MatrixTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "MatrixTest", TestFilePath = @"", @@ -675,7 +675,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG try { var testClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var methodInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -733,7 +733,7 @@ file partial class TimeoutCancellationTokenTests : TUnit.Core.Interfaces.SourceG { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{classDataIndex}:CL-MDS0:TL-ARGS2:TUnit.TestProject.TimeoutCancellationTokenTests(System.Int32).MatrixTest(System.Int32,System.Threading.CancellationToken):0", TestClass = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - ReturnType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), "MatrixTest", 0, [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.Threading.CancellationToken)], TestName = "MatrixTest", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt index 716e310d7d..41b292a102 100644 --- a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt @@ -29,7 +29,7 @@ file partial class TupleDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene try { var testClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var methodInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); + var methodInfo = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]); var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); @@ -79,7 +79,7 @@ file partial class TupleDataSourceDrivenTests : TUnit.Core.Interfaces.SourceGene { TestId = $"global::TUnit.Core.MethodDataSourceAttribute:{testMethodDataIndex}:TL-MDS0:TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod(System.Int32,System.String,System.Boolean):0", TestClass = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), - ReturnType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, + ReturnType = global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), "DataSource_TupleMethod", 0, [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)]).ReturnType, ParameterTypeFullNames = [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.Boolean)], TestName = "DataSource_TupleMethod", TestFilePath = @"", diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/ArgumentsRetriever.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/ArgumentsRetriever.cs index 38cc975ef1..13adca5bf4 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/ArgumentsRetriever.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/ArgumentsRetriever.cs @@ -63,7 +63,7 @@ public static IEnumerable GetArguments(GeneratorAttributeSyntaxCo if (dataAttribute.AttributeClass?.IsOrInherits(WellKnownFullyQualifiedClassNames .DataSourceGeneratorAttribute.WithGlobalPrefix) == true) { - yield return DataSourceGeneratorRetriever.Parse(namedTypeSymbol, dataAttribute, argumentsType, + yield return DataSourceGeneratorRetriever.Parse(context, namedTypeSymbol, dataAttribute, argumentsType, index, propertyName); } } diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/DataSourceGeneratorRetriever.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/DataSourceGeneratorRetriever.cs index 9d92977178..1f5b9a69d6 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/DataSourceGeneratorRetriever.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/DataSourceGeneratorRetriever.cs @@ -7,15 +7,16 @@ namespace TUnit.Core.SourceGenerator.CodeGenerators.Helpers; public static class DataSourceGeneratorRetriever { - public static ArgumentsContainer Parse( - INamedTypeSymbol namedTypeSymbol, - AttributeData attributeData, - ArgumentsType argumentsType, + public static ArgumentsContainer Parse(GeneratorAttributeSyntaxContext context, INamedTypeSymbol namedTypeSymbol, + AttributeData attributeData, + ArgumentsType argumentsType, int index, string? propertyName) { return new GeneratedArgumentsContainer ( + context, + attributeData: attributeData, ArgumentsType: argumentsType, TestClassTypeName: namedTypeSymbol.ToDisplayString(DisplayFormats.FullyQualifiedGenericWithGlobalPrefix), AttributeDataGeneratorType: attributeData.AttributeClass!.ToDisplayString(DisplayFormats diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/FullyQualifiedWithGlobalPrefixRewriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/FullyQualifiedWithGlobalPrefixRewriter.cs index 49ad069eb1..5da6028f0e 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/FullyQualifiedWithGlobalPrefixRewriter.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/FullyQualifiedWithGlobalPrefixRewriter.cs @@ -29,7 +29,14 @@ public override SyntaxNode VisitIdentifierName(IdentifierNameSyntax node) { var symbol = node.GetSymbolInfo(semanticModel); - if (symbol.IsConst(out var constantValue)) + if (symbol is not IFieldSymbol + { + Type: INamedTypeSymbol + { + TypeKind: TypeKind.Enum + } + } + && symbol.IsConst(out var constantValue)) { return Literal(constantValue); } diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TestSourceDataModelRetriever.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TestSourceDataModelRetriever.cs index 36219fe979..765ee9a74f 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TestSourceDataModelRetriever.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TestSourceDataModelRetriever.cs @@ -1,6 +1,6 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; +using TUnit.Core.SourceGenerator.CodeGenerators.Writers; using TUnit.Core.SourceGenerator.Enums; using TUnit.Core.SourceGenerator.Extensions; using TUnit.Core.SourceGenerator.Models; @@ -123,15 +123,15 @@ private static TestSourceDataModel GetTestSourceDataModel(TestGenerationContext var testArguments = testGenerationContext.TestArguments; var testAttribute = testGenerationContext.TestAttribute; - var testAttributes = methodSymbol.GetAttributes(); - var classAttributes = namedTypeSymbol.GetAttributesIncludingBaseTypes().ToImmutableArray(); - var assemblyAttributes = namedTypeSymbol.ContainingAssembly.GetAttributes(); + var testAttributes = methodSymbol.GetAttributes().ExcludingSystemAttributes(); + var classAttributes = namedTypeSymbol.GetAttributesIncludingBaseTypes().ExcludingSystemAttributes(); + var assemblyAttributes = namedTypeSymbol.ContainingAssembly.GetAttributes().ExcludingSystemAttributes(); AttributeData[] allAttributes = [ - ..testAttributes.Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime"), - ..classAttributes.Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime"), - ..assemblyAttributes.Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime") + ..testAttributes, + ..classAttributes, + ..assemblyAttributes ]; var propertyAttributes = testGenerationContext.PropertyArguments @@ -139,14 +139,6 @@ private static TestSourceDataModel GetTestSourceDataModel(TestGenerationContext .Select(x => x.PropertySymbol) .SelectMany(x => x.GetAttributes()) .Where(x => x.IsDataSourceAttribute()); - - var methodNonGenericTypes = GetNonGenericTypes(testGenerationContext.MethodSymbol.Parameters, - testArguments.GetArgumentTypes()); - - var classNonGenericTypes = - GetNonGenericTypes( - testGenerationContext.ClassSymbol.InstanceConstructors.FirstOrDefault()?.Parameters ?? ImmutableArray.Empty, - classArguments.GetArgumentTypes()); return new TestSourceDataModel { @@ -159,77 +151,31 @@ private static TestSourceDataModel GetTestSourceDataModel(TestGenerationContext RepeatLimit = TestInformationRetriever.GetRepeatCount(allAttributes), CurrentRepeatAttempt = testGenerationContext.CurrentRepeatAttempt, ClassArguments = classArguments, - ClassParameterOrArgumentNonGenericTypes = classNonGenericTypes.ToArray(), MethodArguments = testArguments, FilePath = testAttribute.ConstructorArguments[0].Value?.ToString() ?? string.Empty, LineNumber = testAttribute.ConstructorArguments[1].Value as int? ?? 0, - MethodParameterTypes = [..methodSymbol.Parameters.Select(x => x.Type.GloballyQualified())], - MethodParameterOrArgumentNonGenericTypes = methodNonGenericTypes.ToArray(), + MethodParameterTypes = [ ..methodSymbol.Parameters.Select(x => x.Type.GloballyQualified()) ], + MethodArgumentTypes = [..GetParameterTypes(methodSymbol, testArguments.GetArgumentTypes())], MethodParameterNames = [..methodSymbol.Parameters.Select(x => x.Name)], MethodGenericTypeCount = methodSymbol.TypeParameters.Length, TestExecutor = allAttributes.FirstOrDefault(x => x.AttributeClass?.IsOrInherits("global::TUnit.Core.Executors.TestExecutorAttribute") == true)?.AttributeClass?.TypeArguments.FirstOrDefault()?.GloballyQualified(), - TestAttributes = WriteAttributes(testGenerationContext.Context, testAttributes), - ClassAttributes = WriteAttributes(testGenerationContext.Context, classAttributes), - AssemblyAttributes = WriteAttributes(testGenerationContext.Context, assemblyAttributes), + TestAttributes = AttributeWriter.WriteAttributes(testGenerationContext.Context, testAttributes), + ClassAttributes = AttributeWriter.WriteAttributes(testGenerationContext.Context, classAttributes), + AssemblyAttributes = AttributeWriter.WriteAttributes(testGenerationContext.Context, assemblyAttributes), PropertyAttributeTypes = propertyAttributes.Select(x => x.AttributeClass?.GloballyQualified()).OfType().ToArray(), PropertyArguments = testGenerationContext.PropertyArguments, }; } - - private static string[] WriteAttributes(GeneratorAttributeSyntaxContext context, ImmutableArray attributeDatas) - { - return attributeDatas - .Where(x => x.AttributeClass?.ContainingAssembly?.Name != "System.Runtime") - .Select(x => WriteAttribute(context, x)) - .Where(x => !string.IsNullOrEmpty(x)) - .ToArray(); - } - - private static string WriteAttribute(GeneratorAttributeSyntaxContext context, AttributeData attributeData) - { - if (attributeData.ApplicationSyntaxReference is null) - { - return string.Empty; - } - - var attributeSyntax = attributeData.ApplicationSyntaxReference.GetSyntax(); - - var constructorArgumentSyntaxes = attributeSyntax.DescendantNodes() - .OfType() - .Where(x => x.NameEquals is null); - - var typedConstantsToExpression = - constructorArgumentSyntaxes.Zip(attributeData.ConstructorArguments, (syntax, constant) => (syntax, constant)); - - var constructorArguments = typedConstantsToExpression.Select(x => - TypedConstantParser.GetTypedConstantValue(context.SemanticModel, x.syntax.Expression, x.constant.Type)); - - var namedArgSyntaxes = attributeSyntax.DescendantNodes() - .OfType() - .Where(x => x.NameEquals is not null) - .ToArray(); - - var namedArguments = attributeData.NamedArguments.Select(x => - $"{x.Key} = {TypedConstantParser.GetTypedConstantValue(context.SemanticModel, namedArgSyntaxes.First(stx => stx.NameEquals?.Name.Identifier.ValueText == x.Key).Expression, x.Value.Type)},"); - - return $$""" - new {{attributeData.AttributeClass!.GloballyQualified()}}({{string.Join(", ", constructorArguments)}}) - { - {{string.Join(" ", namedArguments)}} - } - """; - } - private static IEnumerable GetNonGenericTypes(ImmutableArray methodSymbolParameters, - string[] argumentTypes) + private static IEnumerable GetParameterTypes(IMethodSymbol methodSymbol, string[] argumentTypes) { - for (var i = 0; i < methodSymbolParameters.Length; i++) + for (var index = 0; index < methodSymbol.Parameters.Length; index++) { - var parameter = methodSymbolParameters[i]; + var parameter = methodSymbol.Parameters[index]; if (parameter.Type.IsGenericDefinition()) { - yield return argumentTypes.ElementAtOrDefault(i) ?? "global::System.Threading.CancellationToken"; + yield return argumentTypes[index]; } else { diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/PolyfillGenerator.cs b/TUnit.Core.SourceGenerator/CodeGenerators/PolyfillGenerator.cs new file mode 100644 index 0000000000..c3eaacd612 --- /dev/null +++ b/TUnit.Core.SourceGenerator/CodeGenerators/PolyfillGenerator.cs @@ -0,0 +1,83 @@ +using Microsoft.CodeAnalysis; + +namespace TUnit.Core.SourceGenerator.CodeGenerators; + +[Generator] +public class PolyfillGenerator : IIncrementalGenerator +{ + private class PreventCompilationTriggerOnEveryKeystrokeComparer : IEqualityComparer + { + public bool Equals(Compilation? x, Compilation? y) + { + if (ReferenceEquals(x, y)) + { + return true; + } + + if (x is null) + { + return false; + } + + if (y is null) + { + return false; + } + + if (x.GetType() != y.GetType()) + { + return false; + } + + return x.Language == y.Language && x.AssemblyName == y.AssemblyName; + } + + public int GetHashCode(Compilation obj) + { + unchecked + { + return (obj.Language.GetHashCode() * 397) ^ (obj.AssemblyName != null ? obj.AssemblyName.GetHashCode() : 0); + } + } + } + public void Initialize(IncrementalGeneratorInitializationContext context) + { + context.RegisterSourceOutput(context.CompilationProvider + .WithComparer(new PreventCompilationTriggerOnEveryKeystrokeComparer()), (productionContext, compilation) => + { + if (compilation.GetTypeByMetadataName("System.Runtime.CompilerServices.ModuleInitializerAttribute") == null) + { + productionContext.AddSource("ModuleInitializerAttribute.g.cs", + """ + namespace System.Runtime.CompilerServices; + + using System; + using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; + + [AttributeUsage(AttributeTargets.Method, Inherited = false)] + sealed class ModuleInitializerAttribute : Attribute; + """); + } + + if (compilation.GetTypeByMetadataName("System.Diagnostics.StackTraceHiddenAttribute") == null) + { + productionContext.AddSource("StackTraceHiddenAttribute.g.cs", + """ + namespace System.Diagnostics; + + using System; + using System.Diagnostics.CodeAnalysis; + + [AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Method | + AttributeTargets.Constructor | + AttributeTargets.Struct, + Inherited = false)] + sealed class StackTraceHiddenAttribute : Attribute; + """); + } + }); + } +} \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/TestHooksGenerator.cs b/TUnit.Core.SourceGenerator/CodeGenerators/TestHooksGenerator.cs index 36785790c1..8166dffd7c 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/TestHooksGenerator.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/TestHooksGenerator.cs @@ -61,6 +61,8 @@ static IEnumerable GetSemanticTargetForGeneration(GeneratorAttri yield return new HooksDataModel { + Context = context, + Method = methodSymbol, MethodName = methodSymbol.Name, HookLocationType = hookLocationType, IsEveryHook = isEveryHook && hookLevel is not "TUnit.Core.HookType.TestDiscovery" and not "TUnit.Core.HookType.TestSession", diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/AttributeWriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/AttributeWriter.cs new file mode 100644 index 0000000000..dc8813519b --- /dev/null +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/AttributeWriter.cs @@ -0,0 +1,55 @@ +using System.Collections.Immutable; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using TUnit.Core.SourceGenerator.CodeGenerators.Helpers; +using TUnit.Core.SourceGenerator.Extensions; + +namespace TUnit.Core.SourceGenerator.CodeGenerators.Writers; + +public class AttributeWriter +{ + public static string[] WriteAttributes(GeneratorAttributeSyntaxContext context, ImmutableArray attributeDatas) + { + return attributeDatas + .Where(x => x.AttributeClass?.ContainingAssembly?.Name != "System.Runtime") + .Select(x => WriteAttribute(context, x)) + .Where(x => !string.IsNullOrEmpty(x)) + .ToArray(); + } + + public static string WriteAttribute(GeneratorAttributeSyntaxContext context, AttributeData attributeData) + { + if (attributeData.ApplicationSyntaxReference is null + || attributeData.AttributeClass?.ContainingAssembly?.Name == "System.Runtime") + { + return string.Empty; + } + + var attributeSyntax = attributeData.ApplicationSyntaxReference.GetSyntax(); + + var constructorArgumentSyntaxes = attributeSyntax.DescendantNodes() + .OfType() + .Where(x => x.NameEquals is null); + + var typedConstantsToExpression = + constructorArgumentSyntaxes.Zip(attributeData.ConstructorArguments, (syntax, constant) => (syntax, constant)); + + var constructorArguments = typedConstantsToExpression.Select(x => + TypedConstantParser.GetTypedConstantValue(context.SemanticModel, x.syntax.Expression, x.constant.Type)); + + var namedArgSyntaxes = attributeSyntax.DescendantNodes() + .OfType() + .Where(x => x.NameEquals is not null) + .ToArray(); + + var namedArguments = attributeData.NamedArguments.Select(x => + $"{x.Key} = {TypedConstantParser.GetTypedConstantValue(context.SemanticModel, namedArgSyntaxes.First(stx => stx.NameEquals?.Name.Identifier.ValueText == x.Key).Expression, x.Value.Type)},"); + + return $$""" + new {{attributeData.AttributeClass!.GloballyQualified()}}({{string.Join(", ", constructorArguments)}}) + { + {{string.Join(" ", namedArguments)}} + } + """; + } +} \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/FailedTestInitializationWriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/FailedTestInitializationWriter.cs index 48e1e16c1c..04326d9dd6 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/FailedTestInitializationWriter.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/FailedTestInitializationWriter.cs @@ -14,8 +14,8 @@ public static void GenerateFailedTestCode(SourceCodeWriter sourceBuilder, sourceBuilder.WriteLine("{"); sourceBuilder.WriteLine($"TestId = $\"{testId}\","); sourceBuilder.WriteLine($"TestClass = typeof({testSourceDataModel.FullyQualifiedTypeName}),"); - sourceBuilder.WriteLine($"ReturnType = {MethodInfoWriter.Write(testSourceDataModel, testSourceDataModel.MethodParameterOrArgumentNonGenericTypes.Select(x => $"typeof({x})").ToCommaSeparatedString())}.ReturnType,"); - sourceBuilder.WriteLine($"ParameterTypeFullNames = [{string.Join(", ", testSourceDataModel.MethodParameterOrArgumentNonGenericTypes.Select(x => $"typeof({x})"))}],"); + sourceBuilder.WriteLine($"ReturnType = {MethodInfoWriter.Write(testSourceDataModel)}.ReturnType,"); + sourceBuilder.WriteLine($"ParameterTypeFullNames = [{string.Join(", ", testSourceDataModel.MethodArgumentTypes.Select(x => $"typeof({x})"))}],"); sourceBuilder.WriteLine($"TestName = \"{testSourceDataModel.MethodName}\","); sourceBuilder.WriteLine($"TestFilePath = @\"{testSourceDataModel.FilePath}\","); sourceBuilder.WriteLine($"TestLineNumber = {testSourceDataModel.LineNumber},"); diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/GenericTestInvocationWriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/GenericTestInvocationWriter.cs index 6091ce1f72..c354856970 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/GenericTestInvocationWriter.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/GenericTestInvocationWriter.cs @@ -13,11 +13,9 @@ public static void GenerateTestInvocationCode(SourceCodeWriter sourceBuilder, var fullyQualifiedClassType = testSourceDataModel.FullyQualifiedTypeName; - var methodParameterTypesList = string.Join(", ", testSourceDataModel.MethodParameterOrArgumentNonGenericTypes.Select(x => $"typeof({x})")); - sourceBuilder.WriteLine($"var testClassType = typeof({fullyQualifiedClassType});"); - sourceBuilder.WriteLine($"var methodInfo = {MethodInfoWriter.Write(testSourceDataModel, methodParameterTypesList)};"); + sourceBuilder.WriteLine($"var methodInfo = {MethodInfoWriter.Write(testSourceDataModel)};"); sourceBuilder.WriteLine(); diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/AssemblyHooksWriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/AssemblyHooksWriter.cs index ff30e17f1f..9800225ee0 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/AssemblyHooksWriter.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/AssemblyHooksWriter.cs @@ -1,5 +1,7 @@ -using TUnit.Core.SourceGenerator.CodeGenerators.Helpers; +using System.Collections.Immutable; +using TUnit.Core.SourceGenerator.CodeGenerators.Helpers; using TUnit.Core.SourceGenerator.Enums; +using TUnit.Core.SourceGenerator.Extensions; using TUnit.Core.SourceGenerator.Models; namespace TUnit.Core.SourceGenerator.CodeGenerators.Writers.Hooks; @@ -23,7 +25,7 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel? model } sourceBuilder.WriteLine("{ "); - sourceBuilder.WriteLine($"""MethodInfo = typeof({model.FullyQualifiedTypeName}).GetMethod("{model.MethodName}", 0, [{string.Join(", ", model.ParameterTypes.Select(x => $"typeof({x})"))}]),"""); + sourceBuilder.WriteLine($"""MethodInfo = {MethodInfoWriter.Write(model)},"""); if(model.IsVoid) { @@ -38,6 +40,12 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel? model sourceBuilder.WriteLine($"Order = {model.Order},"); sourceBuilder.WriteLine($"""FilePath = @"{model.FilePath}","""); sourceBuilder.WriteLine($"LineNumber = {model.LineNumber},"); + sourceBuilder.WriteLine( + $"MethodAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"ClassAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingType.GetAttributesIncludingBaseTypes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"AssemblyAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingAssembly.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); sourceBuilder.WriteLine("},"); } diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/ClassHooksWriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/ClassHooksWriter.cs index 73031b3cd7..e566db6be1 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/ClassHooksWriter.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/ClassHooksWriter.cs @@ -1,5 +1,6 @@ using TUnit.Core.SourceGenerator.CodeGenerators.Helpers; using TUnit.Core.SourceGenerator.Enums; +using TUnit.Core.SourceGenerator.Extensions; using TUnit.Core.SourceGenerator.Models; namespace TUnit.Core.SourceGenerator.CodeGenerators.Writers.Hooks; @@ -18,7 +19,7 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel model) } sourceBuilder.WriteLine("{ "); - sourceBuilder.WriteLine($"""MethodInfo = typeof({model.FullyQualifiedTypeName}).GetMethod("{model.MethodName}", 0, [{string.Join(", ", model.ParameterTypes.Select(x => $"typeof({x})"))}]),"""); + sourceBuilder.WriteLine($"""MethodInfo = {MethodInfoWriter.Write(model)},"""); if(model.IsVoid) { @@ -33,6 +34,12 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel model) sourceBuilder.WriteLine($"Order = {model.Order},"); sourceBuilder.WriteLine($"""FilePath = @"{model.FilePath}","""); sourceBuilder.WriteLine($"LineNumber = {model.LineNumber},"); + sourceBuilder.WriteLine( + $"MethodAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"ClassAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingType.GetAttributesIncludingBaseTypes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"AssemblyAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingAssembly.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); sourceBuilder.WriteLine("},"); } diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/GlobalTestHooksWriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/GlobalTestHooksWriter.cs index 214d0206fb..abaaa0f087 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/GlobalTestHooksWriter.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/GlobalTestHooksWriter.cs @@ -1,5 +1,6 @@ using TUnit.Core.SourceGenerator.CodeGenerators.Helpers; using TUnit.Core.SourceGenerator.Enums; +using TUnit.Core.SourceGenerator.Extensions; using TUnit.Core.SourceGenerator.Models; namespace TUnit.Core.SourceGenerator.CodeGenerators.Writers.Hooks; @@ -10,7 +11,7 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel model) { sourceBuilder.WriteLine($"new {GetClassType(model.HookLevel, model.HookLocationType)}"); sourceBuilder.WriteLine("{"); - sourceBuilder.WriteLine($"""MethodInfo = typeof({model.FullyQualifiedTypeName}).GetMethod("{model.MethodName}", 0, [{string.Join(", ", model.ParameterTypes.Select(x => $"typeof({x})"))}]),"""); + sourceBuilder.WriteLine($"""MethodInfo = {MethodInfoWriter.Write(model)},"""); if (model.IsVoid) { @@ -27,6 +28,12 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel model) sourceBuilder.WriteLine($"Order = {model.Order},"); sourceBuilder.WriteLine($"""FilePath = @"{model.FilePath}","""); sourceBuilder.WriteLine($"LineNumber = {model.LineNumber},"); + sourceBuilder.WriteLine( + $"MethodAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"ClassAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingType.GetAttributesIncludingBaseTypes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"AssemblyAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingAssembly.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); sourceBuilder.WriteLine("},"); } diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/TestHooksWriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/TestHooksWriter.cs index 8fa92357b1..39c528b540 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/TestHooksWriter.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/TestHooksWriter.cs @@ -1,5 +1,6 @@ using TUnit.Core.SourceGenerator.CodeGenerators.Helpers; using TUnit.Core.SourceGenerator.Enums; +using TUnit.Core.SourceGenerator.Extensions; using TUnit.Core.SourceGenerator.Models; namespace TUnit.Core.SourceGenerator.CodeGenerators.Writers.Hooks; @@ -20,7 +21,7 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel model) } sourceBuilder.WriteLine("{ "); - sourceBuilder.WriteLine($"""MethodInfo = typeof({model.FullyQualifiedTypeName}).GetMethod("{model.MethodName}", 0, [{string.Join(", ", model.ParameterTypes.Select(x => $"typeof({x})"))}]),"""); + sourceBuilder.WriteLine($"""MethodInfo = {MethodInfoWriter.Write(model)},"""); if(model.IsVoid) { @@ -35,6 +36,12 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel model) sourceBuilder.WriteLine($"Order = {model.Order},"); sourceBuilder.WriteLine($"""FilePath = @"{model.FilePath}","""); sourceBuilder.WriteLine($"LineNumber = {model.LineNumber},"); + sourceBuilder.WriteLine( + $"MethodAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"ClassAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingType.GetAttributesIncludingBaseTypes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"AssemblyAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingAssembly.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); sourceBuilder.WriteLine("},"); return; @@ -42,7 +49,7 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel model) sourceBuilder.WriteLine($"new InstanceHookMethod<{model.FullyQualifiedTypeName}>"); sourceBuilder.WriteLine("{"); - sourceBuilder.WriteLine($"""MethodInfo = typeof({model.FullyQualifiedTypeName}).GetMethod("{model.MethodName}", 0, [{string.Join(", ", model.ParameterTypes.Select(x => $"typeof({x})"))}]),"""); + sourceBuilder.WriteLine($"""MethodInfo = {MethodInfoWriter.Write(model)},"""); if(model.IsVoid) { @@ -55,6 +62,12 @@ public static void Execute(SourceCodeWriter sourceBuilder, HooksDataModel model) sourceBuilder.WriteLine($"HookExecutor = {HookExecutorHelper.GetHookExecutor(model.HookExecutor)},"); sourceBuilder.WriteLine($"Order = {model.Order},"); + sourceBuilder.WriteLine( + $"MethodAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"ClassAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingType.GetAttributesIncludingBaseTypes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); + sourceBuilder.WriteLine( + $"AssemblyAttributes = [ {AttributeWriter.WriteAttributes(model.Context, model.Method.ContainingAssembly.GetAttributes().ExcludingSystemAttributes()).ToCommaSeparatedString()} ],"); sourceBuilder.WriteLine("},"); } } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/MethodInfoWriter.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/MethodInfoWriter.cs index 55a4f1106f..b66b8c6316 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Writers/MethodInfoWriter.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Writers/MethodInfoWriter.cs @@ -4,23 +4,13 @@ namespace TUnit.Core.SourceGenerator.CodeGenerators.Writers; public static class MethodInfoWriter { - public static string Write(TestSourceDataModel testSourceDataModel, string methodParameterTypesList) + public static string Write(TestSourceDataModel testSourceDataModel) { - if (testSourceDataModel.MethodGenericTypeCount == 0) - { - return - $"typeof({testSourceDataModel.FullyQualifiedTypeName}).GetMethod(\"{testSourceDataModel.MethodName}\", {testSourceDataModel.MethodGenericTypeCount}, [{methodParameterTypesList}])"; - } - - return - $""" - typeof({testSourceDataModel.FullyQualifiedTypeName}) - .GetMethods() - .Where(method => method.IsPublic) - .Where(method => method.Name == "{testSourceDataModel.MethodName}") - .Where(method => method.GetParameters().Length == {testSourceDataModel.MethodParameterTypes.Length}) - .Where(method => method.GetGenericArguments().Length == {testSourceDataModel.MethodGenericTypeCount}) - .First() - """; + return $"global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof({testSourceDataModel.FullyQualifiedTypeName}), \"{testSourceDataModel.MethodName}\", {testSourceDataModel.MethodGenericTypeCount}, [{string.Join(", ", testSourceDataModel.MethodArgumentTypes.Select(x => $"typeof({x})"))}])"; + } + + public static string Write(HooksDataModel hooksDataModel) + { + return $"global::TUnit.Core.Helpers.MethodInfoRetriever.GetMethodInfo(typeof({hooksDataModel.FullyQualifiedTypeName}), \"{hooksDataModel.MethodName}\", {hooksDataModel.Method.TypeParameters.Length}, [{string.Join(", ", hooksDataModel.ParameterTypes.Select(x => $"typeof({x})"))}])"; } } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator/Extensions/AttributeDataExtensions.cs b/TUnit.Core.SourceGenerator/Extensions/AttributeDataExtensions.cs index feb7c14e1c..a2debe6a78 100644 --- a/TUnit.Core.SourceGenerator/Extensions/AttributeDataExtensions.cs +++ b/TUnit.Core.SourceGenerator/Extensions/AttributeDataExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.CodeAnalysis; +using System.Collections.Immutable; +using Microsoft.CodeAnalysis; namespace TUnit.Core.SourceGenerator.Extensions; @@ -63,4 +64,12 @@ public static bool IsGlobalHook(this AttributeData attributeData, Compilation co compilation.GetTypeByMetadataName(WellKnownFullyQualifiedClassNames.AfterEveryAttribute .WithoutGlobalPrefix)); } + + public static ImmutableArray ExcludingSystemAttributes( + this IEnumerable attributeDatas) + { + return attributeDatas + .Where(x => x.AttributeClass?.ContainingAssembly.Name != "System.Runtime") + .ToImmutableArray(); + } } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator/Extensions/EnumerableExtensions.cs b/TUnit.Core.SourceGenerator/Extensions/EnumerableExtensions.cs index 45cd4c29b6..0b86482e06 100644 --- a/TUnit.Core.SourceGenerator/Extensions/EnumerableExtensions.cs +++ b/TUnit.Core.SourceGenerator/Extensions/EnumerableExtensions.cs @@ -1,4 +1,6 @@ -namespace TUnit.Core.SourceGenerator.Extensions; +using Microsoft.CodeAnalysis; + +namespace TUnit.Core.SourceGenerator.Extensions; public static class EnumerableExtensions { @@ -6,4 +8,9 @@ public static string ToCommaSeparatedString(this IEnumerable enumerable) { return string.Join(", ", enumerable); } + + public static IEnumerable ExceptSystemAttributes(this IEnumerable attributeDatas) + { + return attributeDatas.Where(x => x.AttributeClass?.ContainingNamespace.Name.StartsWith("System") != true); + } } \ No newline at end of file diff --git a/TUnit.Core.SourceGenerator/Models/Arguments/GeneratedArgumentsContainer.cs b/TUnit.Core.SourceGenerator/Models/Arguments/GeneratedArgumentsContainer.cs index 008b32f606..4ced356cb1 100644 --- a/TUnit.Core.SourceGenerator/Models/Arguments/GeneratedArgumentsContainer.cs +++ b/TUnit.Core.SourceGenerator/Models/Arguments/GeneratedArgumentsContainer.cs @@ -1,12 +1,18 @@ +using Microsoft.CodeAnalysis; +using TUnit.Core.SourceGenerator.CodeGenerators.Writers; using TUnit.Core.SourceGenerator.Enums; namespace TUnit.Core.SourceGenerator.Models.Arguments; public record GeneratedArgumentsContainer : ArgumentsContainer { - public GeneratedArgumentsContainer(ArgumentsType ArgumentsType, int AttributeIndex, string TestClassTypeName, string[] GenericArguments, string AttributeDataGeneratorType) : base(ArgumentsType) + public GeneratedArgumentsContainer(GeneratorAttributeSyntaxContext context, AttributeData attributeData, + ArgumentsType ArgumentsType, int AttributeIndex, string TestClassTypeName, string[] GenericArguments, + string AttributeDataGeneratorType) : base(ArgumentsType) { this.AttributeIndex = AttributeIndex; + Context = context; + AttributeData = attributeData; this.TestClassTypeName = TestClassTypeName; this.GenericArguments = GenericArguments; this.AttributeDataGeneratorType = AttributeDataGeneratorType; @@ -56,8 +62,7 @@ public override void OpenScope(SourceCodeWriter sourceCodeWriter, ref int variab var arrayVariableName = $"{VariableNamePrefix}GeneratedDataArray"; var generatedDataVariableName = $"{VariableNamePrefix}GeneratedData"; - var dataAttr = GenerateDataAttributeVariable("var", - $"{objectToGetAttributesFrom}.GetCustomAttributes<{AttributeDataGeneratorType}>(true).ElementAt({AttributeIndex})", + var dataAttr = GenerateDataAttributeVariable("var", AttributeWriter.WriteAttribute(Context, AttributeData), ref variableIndex); sourceCodeWriter.WriteLine(dataAttr.ToString()); @@ -109,7 +114,7 @@ public override void WriteVariableAssignments(SourceCodeWriter sourceCodeWriter, if (ArgumentsType == ArgumentsType.Property) { var attr = GenerateDataAttributeVariable("var", - $"{objectToGetAttributesFrom}.GetCustomAttributes<{AttributeDataGeneratorType}>(true).ElementAt(0)", + AttributeWriter.WriteAttribute(Context, AttributeData), ref variableIndex); sourceCodeWriter.WriteLine(attr.ToString()); @@ -169,6 +174,8 @@ public override string[] GetArgumentTypes() return GenericArguments; } + public GeneratorAttributeSyntaxContext Context { get; } + public AttributeData AttributeData { get; } public string TestClassTypeName { get; } public string[] GenericArguments { get; } diff --git a/TUnit.Core.SourceGenerator/Models/HooksDataModel.cs b/TUnit.Core.SourceGenerator/Models/HooksDataModel.cs index 9f5668a33e..1d9c655f28 100644 --- a/TUnit.Core.SourceGenerator/Models/HooksDataModel.cs +++ b/TUnit.Core.SourceGenerator/Models/HooksDataModel.cs @@ -1,9 +1,11 @@ -using TUnit.Core.SourceGenerator.Enums; +using Microsoft.CodeAnalysis; +using TUnit.Core.SourceGenerator.Enums; namespace TUnit.Core.SourceGenerator.Models; public record HooksDataModel { + public required GeneratorAttributeSyntaxContext Context { get; init; } public required string FullyQualifiedTypeName { get; init; } public required HookLocationType HookLocationType { get; init; } public required string MinimalTypeName { get; init; } @@ -20,6 +22,8 @@ public record HooksDataModel public required bool IsEveryHook { get; init; } public required bool IsVoid { get; init; } + + public required IMethodSymbol Method { get; init; } public virtual bool Equals(HooksDataModel? other) { diff --git a/TUnit.Core.SourceGenerator/Models/TestSourceDataModel.cs b/TUnit.Core.SourceGenerator/Models/TestSourceDataModel.cs index 15976d535b..39b7208f35 100644 --- a/TUnit.Core.SourceGenerator/Models/TestSourceDataModel.cs +++ b/TUnit.Core.SourceGenerator/Models/TestSourceDataModel.cs @@ -1,4 +1,5 @@ -using TUnit.Core.SourceGenerator.Extensions; +using Microsoft.CodeAnalysis; +using TUnit.Core.SourceGenerator.Extensions; using TUnit.Core.SourceGenerator.Models.Arguments; namespace TUnit.Core.SourceGenerator.Models; @@ -29,7 +30,7 @@ public override int GetHashCode() hashCode = (hashCode * 397) ^ MethodName.GetHashCode(); hashCode = (hashCode * 397) ^ ClassArguments.GetHashCode(); hashCode = (hashCode * 397) ^ MethodArguments.GetHashCode(); - hashCode = (hashCode * 397) ^ MethodParameterTypes.GetHashCode(); + hashCode = (hashCode * 397) ^ MethodArgumentTypes.GetHashCode(); hashCode = (hashCode * 397) ^ MethodParameterNames.GetHashCode(); hashCode = (hashCode * 397) ^ MethodGenericTypeCount; hashCode = (hashCode * 397) ^ TestId.GetHashCode(); @@ -46,14 +47,12 @@ public override int GetHashCode() public required string MethodName { get; init; } public required BaseContainer ClassArguments { get; init; } - public required string[] ClassParameterOrArgumentNonGenericTypes { get; init; } - public required BaseContainer MethodArguments { get; init; } public required string[] MethodParameterTypes { get; init; } + public required string[] MethodArgumentTypes { get; init; } public required string[] MethodParameterNames { get; init; } - public required string[] MethodParameterOrArgumentNonGenericTypes { get; init; } - + public required int MethodGenericTypeCount { get; init; } public required string TestId { get; init; } @@ -82,7 +81,7 @@ public string MethodVariablesWithCancellationToken() ? argumentsContainer.DataVariables.Select(x => x.Name) : []; - if (MethodParameterTypes.Any(type => type == WellKnownFullyQualifiedClassNames.CancellationToken.WithGlobalPrefix)) + if (MethodArgumentTypes.Any(type => type == WellKnownFullyQualifiedClassNames.CancellationToken.WithGlobalPrefix)) { variableNames = [..variableNames, "cancellationToken"]; } diff --git a/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.csproj b/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.csproj index a768cd6433..8f4851fad8 100644 --- a/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.csproj +++ b/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.csproj @@ -18,7 +18,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TUnit.Core/AsyncEvent.cs b/TUnit.Core/AsyncEvent.cs index 0d978b77e5..b00da2e6bf 100644 --- a/TUnit.Core/AsyncEvent.cs +++ b/TUnit.Core/AsyncEvent.cs @@ -5,12 +5,11 @@ namespace TUnit.Core; public class AsyncEvent { private readonly List> _invocationList; - private readonly Lock _locker; + private readonly Lock _locker = new(); private AsyncEvent() { _invocationList = []; - _locker = new(); } public static AsyncEvent operator +( diff --git a/TUnit.Core/Attributes/Executors/TestExecutorAttribute.cs b/TUnit.Core/Attributes/Executors/TestExecutorAttribute.cs index 1dc5116a23..16999f1185 100644 --- a/TUnit.Core/Attributes/Executors/TestExecutorAttribute.cs +++ b/TUnit.Core/Attributes/Executors/TestExecutorAttribute.cs @@ -5,9 +5,11 @@ namespace TUnit.Core.Executors; [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] public sealed class TestExecutorAttribute : TUnitAttribute, ITestRegisteredEventReceiver where T : ITestExecutor, new() { + public int Order => 0; + public ValueTask OnTestRegistered(TestRegisteredContext context) { context.SetTestExecutor(new T()); - return ValueTask.CompletedTask; + return default; } } \ No newline at end of file diff --git a/TUnit.Core/Attributes/ParallelGroupAttribute.cs b/TUnit.Core/Attributes/ParallelGroupAttribute.cs index 1861b4f56e..f617da7803 100644 --- a/TUnit.Core/Attributes/ParallelGroupAttribute.cs +++ b/TUnit.Core/Attributes/ParallelGroupAttribute.cs @@ -4,6 +4,8 @@ namespace TUnit.Core; public class ParallelGroupAttribute(string group) : TUnitAttribute, ITestDiscoveryEventReceiver { + public int Order => 0; + public string Group { get; } = group; public void OnTestDiscovery(DiscoveredTestContext discoveredTestContext) diff --git a/TUnit.Core/Attributes/ParallelLimiterAttribute.cs b/TUnit.Core/Attributes/ParallelLimiterAttribute.cs index caa0ac0719..f340618236 100644 --- a/TUnit.Core/Attributes/ParallelLimiterAttribute.cs +++ b/TUnit.Core/Attributes/ParallelLimiterAttribute.cs @@ -6,9 +6,11 @@ namespace TUnit.Core; public sealed class ParallelLimiterAttribute : TUnitAttribute, ITestRegisteredEventReceiver where TParallelLimit : IParallelLimit, new() { + public int Order => 0; + public ValueTask OnTestRegistered(TestRegisteredContext testRegisteredContext) { testRegisteredContext.SetParallelLimiter(new TParallelLimit()); - return ValueTask.CompletedTask; + return default; } }; \ No newline at end of file diff --git a/TUnit.Core/Attributes/TestData/ArgumentDisplayFormatterAttribute.cs b/TUnit.Core/Attributes/TestData/ArgumentDisplayFormatterAttribute.cs index 75e5a71fab..3ad11cb973 100644 --- a/TUnit.Core/Attributes/TestData/ArgumentDisplayFormatterAttribute.cs +++ b/TUnit.Core/Attributes/TestData/ArgumentDisplayFormatterAttribute.cs @@ -4,6 +4,8 @@ namespace TUnit.Core; public abstract class ArgumentDisplayFormatterAttribute : TUnitAttribute, ITestDiscoveryEventReceiver { + public virtual int Order => 0; + public abstract ArgumentDisplayFormatter Formatter { get; } public void OnTestDiscovery(DiscoveredTestContext discoveredTestContext) diff --git a/TUnit.Core/Attributes/TestData/ClassDataSources.cs b/TUnit.Core/Attributes/TestData/ClassDataSources.cs index 0c2107c772..cb77b11079 100644 --- a/TUnit.Core/Attributes/TestData/ClassDataSources.cs +++ b/TUnit.Core/Attributes/TestData/ClassDataSources.cs @@ -187,7 +187,11 @@ public async ValueTask OnTestEnd(SharedType shared, string key, T? item) { if (targetInvocationException.InnerException != null) { +#if NET ExceptionDispatchInfo.Throw(targetInvocationException.InnerException); +#else + ExceptionDispatchInfo.Capture(targetInvocationException.InnerException).Throw(); +#endif } throw; diff --git a/TUnit.Core/Attributes/TestMetadata/CategoryAttribute.cs b/TUnit.Core/Attributes/TestMetadata/CategoryAttribute.cs index ccbc3eee6f..6bb36dfaa2 100644 --- a/TUnit.Core/Attributes/TestMetadata/CategoryAttribute.cs +++ b/TUnit.Core/Attributes/TestMetadata/CategoryAttribute.cs @@ -5,6 +5,8 @@ namespace TUnit.Core; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)] public class CategoryAttribute(string category) : TUnitAttribute, ITestDiscoveryEventReceiver { + public int Order => 0; + public string Category { get; } = category; public void OnTestDiscovery(DiscoveredTestContext discoveredTestContext) diff --git a/TUnit.Core/Attributes/TestMetadata/DisplayNameFormatterAttribute.cs b/TUnit.Core/Attributes/TestMetadata/DisplayNameFormatterAttribute.cs index 3b98a7e2d4..a73d9e0535 100644 --- a/TUnit.Core/Attributes/TestMetadata/DisplayNameFormatterAttribute.cs +++ b/TUnit.Core/Attributes/TestMetadata/DisplayNameFormatterAttribute.cs @@ -7,6 +7,8 @@ namespace TUnit.Core; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, Inherited = false)] public abstract class DisplayNameFormatterAttribute : TUnitAttribute, ITestDiscoveryEventReceiver { + public int Order => 0; + public void OnTestDiscovery(DiscoveredTestContext discoveredTestContext) { var displayName = FormatDisplayName(discoveredTestContext.TestContext); diff --git a/TUnit.Core/Attributes/TestMetadata/PropertyAttribute.cs b/TUnit.Core/Attributes/TestMetadata/PropertyAttribute.cs index d6209598a7..c4d93d2d20 100644 --- a/TUnit.Core/Attributes/TestMetadata/PropertyAttribute.cs +++ b/TUnit.Core/Attributes/TestMetadata/PropertyAttribute.cs @@ -5,6 +5,8 @@ namespace TUnit.Core; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)] public class PropertyAttribute(string name, string value) : TUnitAttribute, ITestDiscoveryEventReceiver { + public int Order => 0; + public string Name { get; } = name; public string Value { get; } = value; diff --git a/TUnit.Core/Attributes/TestMetadata/RetryAttribute.cs b/TUnit.Core/Attributes/TestMetadata/RetryAttribute.cs index df4737be8d..8387b677b3 100644 --- a/TUnit.Core/Attributes/TestMetadata/RetryAttribute.cs +++ b/TUnit.Core/Attributes/TestMetadata/RetryAttribute.cs @@ -5,6 +5,8 @@ namespace TUnit.Core; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] public class RetryAttribute : TUnitAttribute, ITestDiscoveryEventReceiver { + public int Order => 0; + public int Times { get; } public RetryAttribute(int times) diff --git a/TUnit.Core/Attributes/TestMetadata/TimeoutAttribute.cs b/TUnit.Core/Attributes/TestMetadata/TimeoutAttribute.cs index f616cfbc50..bc97995791 100644 --- a/TUnit.Core/Attributes/TestMetadata/TimeoutAttribute.cs +++ b/TUnit.Core/Attributes/TestMetadata/TimeoutAttribute.cs @@ -5,6 +5,8 @@ namespace TUnit.Core; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] public class TimeoutAttribute(int timeoutInMilliseconds) : TUnitAttribute, ITestDiscoveryEventReceiver { + public int Order => 0; + public TimeSpan Timeout { get; } = TimeSpan.FromMilliseconds(timeoutInMilliseconds); public void OnTestDiscovery(DiscoveredTestContext discoveredTestContext) diff --git a/TUnit.Core/Data/GetOnlyDictionary.cs b/TUnit.Core/Data/GetOnlyDictionary.cs index f99cfcaa1c..fb2d4d61d5 100644 --- a/TUnit.Core/Data/GetOnlyDictionary.cs +++ b/TUnit.Core/Data/GetOnlyDictionary.cs @@ -10,7 +10,7 @@ public class GetOnlyDictionary where TKey : notnull private ConcurrentDictionary InnerDictionary { get; } = new(); private static readonly Lock Lock = new(); - + public ICollection Keys => InnerDictionary.Keys; public ICollection Values => InnerDictionary.Values; diff --git a/TUnit.Core/DiscoveredTest.cs b/TUnit.Core/DiscoveredTest.cs index 505efc32a7..8cb8fab581 100644 --- a/TUnit.Core/DiscoveredTest.cs +++ b/TUnit.Core/DiscoveredTest.cs @@ -2,7 +2,7 @@ namespace TUnit.Core; -internal class DiscoveredTest< +internal record DiscoveredTest< [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis .DynamicallyAccessedMemberTypes.All)] TTestClass @@ -25,7 +25,7 @@ public override async Task ResetTestInstance() public override IClassConstructor? ClassConstructor => resettableLazyTestClassFactory.ClassConstructor; } -internal abstract class DiscoveredTest +internal abstract record DiscoveredTest : IComparable, IComparable { public required TestContext TestContext { get; init; } @@ -40,4 +40,14 @@ internal abstract class DiscoveredTest public abstract IClassConstructor? ClassConstructor { get; } public IHookExecutor? HookExecutor { get; internal set; } + + public int CompareTo(object? obj) + { + return CompareTo(obj as DiscoveredTest); + } + + public int CompareTo(DiscoveredTest? other) + { + return string.Compare(other?.TestDetails.TestId, TestDetails.TestId, StringComparison.Ordinal); + } } \ No newline at end of file diff --git a/TUnit.Core/Extensions/TestContextExtensions.cs b/TUnit.Core/Extensions/TestContextExtensions.cs index c733a01494..0b17cc585e 100644 --- a/TUnit.Core/Extensions/TestContextExtensions.cs +++ b/TUnit.Core/Extensions/TestContextExtensions.cs @@ -5,6 +5,8 @@ namespace TUnit.Core.Extensions; public static class TestContextExtensions { + private static readonly char[] ClassTypeNameSplitter = { '.' }; + public static TestContext[] GetTests(this TestContext context, string testName) { return GetTests(context, testName, []); @@ -25,13 +27,13 @@ public static TestContext[] GetTests(this TestContext context, string testName, return tests; } - + public static string GetClassTypeName(this TestContext testContext) { var testDetails = testContext.TestDetails; var classTypeName = testDetails.ClassType.FullName? - .Split('.', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) + .Split(ClassTypeNameSplitter, StringSplitOptions.RemoveEmptyEntries) .LastOrDefault() ?? testDetails.ClassType.Name; @@ -50,7 +52,7 @@ public static string GetTestDisplayName(this TestContext testContext) if (!string.IsNullOrWhiteSpace(testDetails.DisplayName)) { - return testDetails.DisplayName; + return testDetails.DisplayName!; } if (testDetails.TestMethodArguments.Length == 0) diff --git a/TUnit.Core/Helpers/AttributeHelper.cs b/TUnit.Core/Helpers/AttributeHelper.cs deleted file mode 100644 index 65536d04d2..0000000000 --- a/TUnit.Core/Helpers/AttributeHelper.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Reflection; - -namespace TUnit.Core.Helpers; - -internal static class AttributeHelper -{ - public static TAttribute? GetAttribute(Type type, MethodInfo methodInfo) where TAttribute : Attribute - { - return methodInfo.GetCustomAttributes() - .Concat(type.GetCustomAttributes()) - .FirstOrDefault(); - } - - public static TAttribute? GetAttribute(MethodInfo methodInfo) where TAttribute : Attribute - { - return methodInfo.GetCustomAttributes().FirstOrDefault(); - } - - public static TAttribute? GetAttribute(IEnumerable attributes) where TAttribute : Attribute - { - return attributes - .OfType() - .FirstOrDefault(); - } -} \ No newline at end of file diff --git a/TUnit.Core/Helpers/MethodInfoRetriever.cs b/TUnit.Core/Helpers/MethodInfoRetriever.cs new file mode 100644 index 0000000000..b8cfb7f759 --- /dev/null +++ b/TUnit.Core/Helpers/MethodInfoRetriever.cs @@ -0,0 +1,29 @@ +using System.Diagnostics.CodeAnalysis; +using System.Reflection; + +namespace TUnit.Core.Helpers; + +public class MethodInfoRetriever +{ + public static MethodInfo GetMethodInfo([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, + string methodName, + int genericParameterCount, + Type[] parameterTypes) + { + if (genericParameterCount == 0) + { + return type.GetMethod(methodName, parameterTypes) + ?? throw new ArgumentException( + $"Method not found: {type}.{methodName}({string.Join(", ", parameterTypes.Select(x => x.Name))})"); + } + + return type + .GetMethods() + .Where(x => x.Name == methodName) + .Where(x => x.IsGenericMethod) + .Where(x => x.GetGenericArguments().Length == genericParameterCount) + .FirstOrDefault(x => x.GetParameters().Length == parameterTypes.Length) + ?? throw new ArgumentException($"Method not found: {type}.{methodName}({string.Join(", ", parameterTypes.Select(x => x.Name))})"); + + } +} \ No newline at end of file diff --git a/TUnit.Core/Hooks/InstanceHookMethod.cs b/TUnit.Core/Hooks/InstanceHookMethod.cs index b42b432e1b..8a5aa01d1b 100644 --- a/TUnit.Core/Hooks/InstanceHookMethod.cs +++ b/TUnit.Core/Hooks/InstanceHookMethod.cs @@ -47,11 +47,15 @@ public abstract record InstanceHookMethod [field: AllowNull, MaybeNull] public string Name => field ??= $"{ClassType.Name}.{MethodInfo.Name}({string.Join(", ", MethodInfo.GetParameters().Select(x => x.ParameterType.Name))})"; + public required Attribute[] MethodAttributes { get; init; } + public required Attribute[] ClassAttributes { get; init; } + public required Attribute[] AssemblyAttributes { get; init; } + [field: AllowNull, MaybeNull] public IEnumerable Attributes => field ??= - [..MethodInfo.GetCustomAttributes(), ..ClassType.GetCustomAttributes(), ..Assembly.GetCustomAttributes()]; + [..MethodAttributes, ..ClassAttributes, ..AssemblyAttributes]; - public TAttribute? GetAttribute() where TAttribute : Attribute => AttributeHelper.GetAttribute(Attributes); + public TAttribute? GetAttribute() where TAttribute : Attribute => Attributes.OfType().FirstOrDefault(); public TimeSpan? Timeout => GetAttribute()?.Timeout; diff --git a/TUnit.Core/Hooks/StaticHookMethod.cs b/TUnit.Core/Hooks/StaticHookMethod.cs index d84fca4570..c311ddc0db 100644 --- a/TUnit.Core/Hooks/StaticHookMethod.cs +++ b/TUnit.Core/Hooks/StaticHookMethod.cs @@ -29,12 +29,16 @@ public abstract record StaticHookMethod public string Name => field ??= $"{ClassType.Name}.{MethodInfo.Name}({string.Join(", ", MethodInfo.GetParameters().Select(x => x.ParameterType.Name))})"; public Type ClassType => MethodInfo.ReflectedType!; public Assembly Assembly => ClassType.Assembly; + + public required Attribute[] MethodAttributes { get; init; } + public required Attribute[] ClassAttributes { get; init; } + public required Attribute[] AssemblyAttributes { get; init; } [field: AllowNull, MaybeNull] public IEnumerable Attributes => field ??= - [..MethodInfo.GetCustomAttributes(), ..ClassType.GetCustomAttributes(), ..Assembly.GetCustomAttributes()]; + [..MethodAttributes, ..ClassAttributes, ..AssemblyAttributes]; - public TAttribute? GetAttribute() where TAttribute : Attribute => AttributeHelper.GetAttribute(Attributes); + public TAttribute? GetAttribute() where TAttribute : Attribute => Attributes.OfType().FirstOrDefault(); public TimeSpan? Timeout => GetAttribute()?.Timeout; diff --git a/TUnit.Core/Interfaces/IEventReceiver.cs b/TUnit.Core/Interfaces/IEventReceiver.cs index 5491bf3a3b..b30a58cde4 100644 --- a/TUnit.Core/Interfaces/IEventReceiver.cs +++ b/TUnit.Core/Interfaces/IEventReceiver.cs @@ -2,5 +2,9 @@ namespace TUnit.Core.Interfaces; public interface IEventReceiver { +#if NET public int Order => 0; +#else + public int Order { get; } +#endif } \ No newline at end of file diff --git a/TUnit.Core/Interfaces/ITestStartEventReceiver.cs b/TUnit.Core/Interfaces/ITestStartEventReceiver.cs index 0481fa3a52..99a4335f63 100644 --- a/TUnit.Core/Interfaces/ITestStartEventReceiver.cs +++ b/TUnit.Core/Interfaces/ITestStartEventReceiver.cs @@ -5,8 +5,12 @@ public interface ITestStartEventReceiver : IEventReceiver ValueTask OnTestStart(BeforeTestContext beforeTestContext); void OnTestStartSynchronous(BeforeTestContext beforeTestContext) +#if NET { - // Default implementation that does nothing - Users can override if they wish - // Synchronous version supports setting AsyncLocal values + // Default implementation that does nothing - Users can override if they wish + // Synchronous version supports setting AsyncLocal values } +#else + ; +#endif } \ No newline at end of file diff --git a/TUnit.Core/Logging/DefaultLogger.cs b/TUnit.Core/Logging/DefaultLogger.cs index b171ee6c06..d763e1c526 100644 --- a/TUnit.Core/Logging/DefaultLogger.cs +++ b/TUnit.Core/Logging/DefaultLogger.cs @@ -41,7 +41,7 @@ private static string FormatValue(object? value) } - public override async Task LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter) + public override async ValueTask LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter) { var message = GenerateMessage(formatter(state, exception), exception, logLevel); diff --git a/TUnit.Core/Logging/ILogger.cs b/TUnit.Core/Logging/ILogger.cs index ee37e59ff9..33ee7f66cb 100644 --- a/TUnit.Core/Logging/ILogger.cs +++ b/TUnit.Core/Logging/ILogger.cs @@ -11,7 +11,7 @@ public interface ILogger /// The exception associated with the message. /// The formatter function to format the message. /// A task representing the asynchronous operation. - Task LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter); + ValueTask LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter); /// /// Logs a message with the specified log level, state, exception, and formatter. diff --git a/TUnit.Core/Logging/LoggingExtensions.cs b/TUnit.Core/Logging/LoggingExtensions.cs index 98a44f14fb..7a101d442b 100644 --- a/TUnit.Core/Logging/LoggingExtensions.cs +++ b/TUnit.Core/Logging/LoggingExtensions.cs @@ -10,28 +10,28 @@ exception is not null #pragma warning restore RS0030 // Do not use banned APIs : state; - public static Task LogTraceAsync(this ILogger logger, string message) + public static ValueTask LogTraceAsync(this ILogger logger, string message) => logger.LogAsync(LogLevel.Trace, message, null, Formatter); - public static Task LogDebugAsync(this ILogger logger, string message) + public static ValueTask LogDebugAsync(this ILogger logger, string message) => logger.LogAsync(LogLevel.Debug, message, null, Formatter); - public static Task LogInformationAsync(this ILogger logger, string message) + public static ValueTask LogInformationAsync(this ILogger logger, string message) => logger.LogAsync(LogLevel.Information, message, null, Formatter); - public static Task LogWarningAsync(this ILogger logger, string message) + public static ValueTask LogWarningAsync(this ILogger logger, string message) => logger.LogAsync(LogLevel.Warning, message, null, Formatter); - public static Task LogErrorAsync(this ILogger logger, string message) + public static ValueTask LogErrorAsync(this ILogger logger, string message) => logger.LogAsync(LogLevel.Error, message, null, Formatter); - public static Task LogErrorAsync(this ILogger logger, string message, Exception ex) + public static ValueTask LogErrorAsync(this ILogger logger, string message, Exception ex) => logger.LogAsync(LogLevel.Error, message, ex, Formatter); - public static Task LogErrorAsync(this ILogger logger, Exception ex) + public static ValueTask LogErrorAsync(this ILogger logger, Exception ex) => logger.LogAsync(LogLevel.Error, ex.ToString(), null, Formatter); - public static Task LogCriticalAsync(this ILogger logger, string message) + public static ValueTask LogCriticalAsync(this ILogger logger, string message) => logger.LogAsync(LogLevel.Critical, message, null, Formatter); public static void LogTrace(this ILogger logger, string message) diff --git a/TUnit.Core/Logging/NullLogger.cs b/TUnit.Core/Logging/NullLogger.cs index 9d5d3c48fb..4cce1b3caf 100644 --- a/TUnit.Core/Logging/NullLogger.cs +++ b/TUnit.Core/Logging/NullLogger.cs @@ -2,10 +2,10 @@ internal class NullLogger : ILogger { - public Task LogAsync(LogLevel logLevel, TState state, Exception? exception, + public ValueTask LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter) { - return Task.CompletedTask; + return default; } public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) diff --git a/TUnit.Core/Logging/TUnitLogger.cs b/TUnit.Core/Logging/TUnitLogger.cs index e3a1f048b9..a1b0edc956 100644 --- a/TUnit.Core/Logging/TUnitLogger.cs +++ b/TUnit.Core/Logging/TUnitLogger.cs @@ -2,7 +2,7 @@ public abstract class TUnitLogger : ILogger { - public abstract Task LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter); + public abstract ValueTask LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter); public abstract void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter); diff --git a/TUnit.Core/Models/LazyHook.cs b/TUnit.Core/Models/LazyHook.cs index 9a3d905deb..76cf4808bc 100644 --- a/TUnit.Core/Models/LazyHook.cs +++ b/TUnit.Core/Models/LazyHook.cs @@ -3,6 +3,7 @@ internal class LazyHook(Func func) { private readonly Lock _lock = new(); + private Task? _value; public Task Value(T1 arg1, T2 arg2) diff --git a/TUnit.Core/ParallelGroupConstraint.cs b/TUnit.Core/ParallelGroupConstraint.cs index d8db628e00..4edc3a0212 100644 --- a/TUnit.Core/ParallelGroupConstraint.cs +++ b/TUnit.Core/ParallelGroupConstraint.cs @@ -2,4 +2,17 @@ namespace TUnit.Core; -public record ParallelGroupConstraint(string Group) : IParallelConstraint; \ No newline at end of file +public record ParallelGroupConstraint(string Group) : IParallelConstraint, + IComparable, + IComparable +{ + public int CompareTo(ParallelGroupConstraint? other) + { + return string.Compare(Group, other?.Group, StringComparison.Ordinal); + } + + public int CompareTo(object? obj) + { + return CompareTo(obj as ParallelGroupConstraint); + } +} \ No newline at end of file diff --git a/TUnit.Core/RunHelpers.cs b/TUnit.Core/RunHelpers.cs index c2652f333b..7e680d817e 100644 --- a/TUnit.Core/RunHelpers.cs +++ b/TUnit.Core/RunHelpers.cs @@ -13,9 +13,9 @@ internal static async Task RunWithTimeoutAsync(Func tas var cancellationToken = cancellationTokenSource.Token; - var taskCompletionSource = new TaskCompletionSource(); + var taskCompletionSource = new TaskCompletionSource(); - await using var cancellationTokenRegistration = cancellationToken.Register(() => + using var cancellationTokenRegistration = cancellationToken.Register(() => { if (token.IsCancellationRequested) { @@ -40,12 +40,16 @@ await await Task.WhenAny { // Try set result if it doesn't have one so it finishes // and doesn't stay pending in background - taskCompletionSource.TrySetResult(); + taskCompletionSource.TrySetResult(false); } } [StackTraceHidden] +#if NET [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] +#else + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static void RunSafely(Action action, List exceptions) { try @@ -59,7 +63,11 @@ public static void RunSafely(Action action, List exceptions) } [StackTraceHidden] +#if NET [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] +#else + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static async Task RunSafelyAsync(Func action, List exceptions) { try @@ -73,7 +81,11 @@ public static async Task RunSafelyAsync(Func action, List excep } [StackTraceHidden] +#if NET [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] +#else + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static async Task RunValueTaskSafelyAsync(Func action, List exceptions) { try diff --git a/TUnit.Core/TUnit.Core.csproj b/TUnit.Core/TUnit.Core.csproj index c29f246206..66dd5186d7 100644 --- a/TUnit.Core/TUnit.Core.csproj +++ b/TUnit.Core/TUnit.Core.csproj @@ -1,9 +1,10 @@  - + + true preview - + true @@ -15,14 +16,13 @@ - - all - analyzers - - \ No newline at end of file + + + + diff --git a/TUnit.Core/TestContextEvents.cs b/TUnit.Core/TestContextEvents.cs index 83cfaeacd2..478ae67b44 100644 --- a/TUnit.Core/TestContextEvents.cs +++ b/TUnit.Core/TestContextEvents.cs @@ -13,6 +13,8 @@ public record TestContextEvents : ILastTestInTestSessionEventReceiver, ITestRetryEventReceiver { + public int Order => 0; + public EventHandler? OnDispose { get; set; } public AsyncEvent? OnTestRegistered { get; set; } public AsyncEvent? OnTestStart { get; set; } @@ -25,46 +27,50 @@ public record TestContextEvents : ValueTask ITestRegisteredEventReceiver.OnTestRegistered(TestRegisteredContext context) { - return OnTestRegistered?.InvokeAsync(this, context) ?? ValueTask.CompletedTask; + return OnTestRegistered?.InvokeAsync(this, context) ?? default; } ValueTask ITestStartEventReceiver.OnTestStart(BeforeTestContext beforeTestContext) { - return OnTestStart?.InvokeAsync(this, beforeTestContext) ?? ValueTask.CompletedTask; + return OnTestStart?.InvokeAsync(this, beforeTestContext) ?? default; } ValueTask ITestEndEventReceiver.OnTestEnd(TestContext testContext) { - return OnTestEnd?.InvokeAsync(this, testContext) ?? ValueTask.CompletedTask; + return OnTestEnd?.InvokeAsync(this, testContext) ?? default; } ValueTask ITestSkippedEventReceiver.OnTestSkipped(TestContext testContext) { - return OnTestSkipped?.InvokeAsync(this, testContext) ?? ValueTask.CompletedTask; + return OnTestSkipped?.InvokeAsync(this, testContext) ?? default; } ValueTask ILastTestInClassEventReceiver.OnLastTestInClass(ClassHookContext context, TestContext testContext) { - return OnLastTestInClass?.InvokeAsync(this, (context, testContext)) ?? ValueTask.CompletedTask; + return OnLastTestInClass?.InvokeAsync(this, (context, testContext)) ?? default; } ValueTask ILastTestInAssemblyEventReceiver.OnLastTestInAssembly(AssemblyHookContext context, TestContext testContext) { - return OnLastTestInAssembly?.InvokeAsync(this, (context, testContext)) ?? ValueTask.CompletedTask; + return OnLastTestInAssembly?.InvokeAsync(this, (context, testContext)) ?? default; } ValueTask ILastTestInTestSessionEventReceiver.OnLastTestInTestSession(TestSessionContext context, TestContext testContext) { - return OnLastTestInTestSession?.InvokeAsync(this, (context, testContext)) ?? ValueTask.CompletedTask; + return OnLastTestInTestSession?.InvokeAsync(this, (context, testContext)) ?? default; } ValueTask ITestRetryEventReceiver.OnTestRetry(TestContext testContext, int retryAttempt) { - return OnTestRetry?.InvokeAsync(this, (testContext, retryAttempt)) ?? ValueTask.CompletedTask; + return OnTestRetry?.InvokeAsync(this, (testContext, retryAttempt)) ?? default; } public void Dispose() { OnDispose?.Invoke(this, EventArgs.Empty); } + + public void OnTestStartSynchronous(BeforeTestContext beforeTestContext) + { + } } \ No newline at end of file diff --git a/TUnit.Core/TestMetadata.cs b/TUnit.Core/TestMetadata.cs index a4349b65ae..f47a9742cc 100644 --- a/TUnit.Core/TestMetadata.cs +++ b/TUnit.Core/TestMetadata.cs @@ -20,7 +20,7 @@ public override TestDetails BuildTestDetails() var testDetails = new TestDetails { TestId = testId, - LazyClassInstance = ResettableClassFactory!, + LazyClassInstance = ResettableClassFactory, ClassType = classType, AssemblyAttributes = AssemblyAttributes, ClassAttributes = ClassAttributes, @@ -57,7 +57,7 @@ public override TestMetadata CloneWithNewMethodFactory(Func testMethodFactory.Invoke(@class!, token), + TestMethodFactory = testMethodFactory.Invoke, ResettableClassFactory = ResettableClassFactory.Clone() }; } diff --git a/TUnit.Engine.Tests/InvokableTestBase.cs b/TUnit.Engine.Tests/InvokableTestBase.cs index 4e9e2f1d5f..f5404e65ba 100644 --- a/TUnit.Engine.Tests/InvokableTestBase.cs +++ b/TUnit.Engine.Tests/InvokableTestBase.cs @@ -21,6 +21,11 @@ protected async Task RunTestsWithFilter(string filter, { await RunWithoutAot(filter, assertions, runOptions, assertionExpression); + if (Environment.GetEnvironmentVariable("NET_VERSION") == "net472") + { + return; + } + await RunWithAot(filter, assertions, runOptions, assertionExpression); await RunWithSingleFile(filter, assertions, runOptions, assertionExpression); @@ -36,7 +41,7 @@ private async Task RunWithoutAot(string filter, [ "run", "--no-build", - "-f", "net9.0", + "-f", Environment.GetEnvironmentVariable("NET_VERSION")!, "--configuration", "Release", "--treenode-filter", filter, "--report-trx", "--report-trx-filename", trxFilename, diff --git a/TUnit.Engine/Capabilities/BannerCapability.cs b/TUnit.Engine/Capabilities/BannerCapability.cs index c8e91789b9..1471ae4a8a 100644 --- a/TUnit.Engine/Capabilities/BannerCapability.cs +++ b/TUnit.Engine/Capabilities/BannerCapability.cs @@ -42,7 +42,11 @@ private string GetRuntimeDetails() $"TUnit v{typeof(BannerCapability).Assembly.GetName().Version!.ToString()}", GetApplicationMemorySize(), RuntimeInformation.OSDescription, +#if NET RuntimeInformation.RuntimeIdentifier, +#else + ".NET Framework", +#endif RuntimeInformation.FrameworkDescription, $"Microsoft Testing Platform v{platformInformation.Version}" ]; diff --git a/TUnit.Engine/Extensions/MethodExtensions.cs b/TUnit.Engine/Extensions/MethodExtensions.cs deleted file mode 100644 index 1d3d6bc937..0000000000 --- a/TUnit.Engine/Extensions/MethodExtensions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Reflection; -using TUnit.Core; - -namespace TUnit.Engine.Extensions; - -internal static class MethodExtensions -{ - public static TimeSpan? GetTimeout(this MethodInfo methodInfo) - { - return methodInfo.GetCustomAttributes().OfType().FirstOrDefault()?.Timeout; - } -} \ No newline at end of file diff --git a/TUnit.Engine/Extensions/TestContextExtensions.cs b/TUnit.Engine/Extensions/TestContextExtensions.cs index b2dd526052..76eb6c1e0c 100644 --- a/TUnit.Engine/Extensions/TestContextExtensions.cs +++ b/TUnit.Engine/Extensions/TestContextExtensions.cs @@ -2,6 +2,7 @@ using System.Reflection; using System.Runtime.ExceptionServices; using Microsoft.Testing.Platform.Extensions.TestFramework; +using Polyfills; using TUnit.Core; using TUnit.Core.Enums; using TUnit.Core.Exceptions; @@ -40,7 +41,7 @@ public static async Task ReregisterTestWithArguments( } catch (TargetInvocationException e) { - ExceptionDispatchInfo.Throw(e.InnerException ?? e); + ExceptionDispatchInfo.Capture(e.InnerException ?? e).Throw(); } } ) with diff --git a/TUnit.Engine/Framework/TUnitServiceProvider.cs b/TUnit.Engine/Framework/TUnitServiceProvider.cs index ca434eaf5a..7107dad7c4 100644 --- a/TUnit.Engine/Framework/TUnitServiceProvider.cs +++ b/TUnit.Engine/Framework/TUnitServiceProvider.cs @@ -88,14 +88,14 @@ public TUnitServiceProvider(IExtension extension, var testHookOrchestrator = Register(new TestHookOrchestrator(hooksCollector)); var testRegistrar = Register(new TestRegistrar(instanceTracker, AssemblyHookOrchestrator, classHookOrchestrator)); - TestDiscoverer = Register(new TUnitTestDiscoverer(hooksCollector, testsLoader, testFilterService, TestGrouper, testRegistrar, TestDiscoveryHookOrchestrator, TUnitMessageBus, LoggerFactory, extension)); + TestDiscoverer = Register(new TUnitTestDiscoverer(hooksCollector, testsLoader, testFilterService, TestGrouper, testRegistrar, TestDiscoveryHookOrchestrator, TUnitMessageBus, Logger, extension)); TestFinder = Register(new TestsFinder(TestDiscoverer)); Register(TestFinder); Disposer = Register(new Disposer(Logger)); - var testInvoker = Register(new TestInvoker(testHookOrchestrator, Disposer)); + var testInvoker = Register(new TestInvoker(testHookOrchestrator, Logger, Disposer)); var explicitFilterService = Register(new ExplicitFilterService()); var parallelLimitProvider = Register(new ParallelLimitLockProvider()); @@ -114,9 +114,14 @@ public TUnitServiceProvider(IExtension extension, public async ValueTask DisposeAsync() { +#if NET await StandardOutConsoleInterceptor.DisposeAsync(); await StandardErrorConsoleInterceptor.DisposeAsync(); - +#else + StandardOutConsoleInterceptor.Dispose(); + StandardErrorConsoleInterceptor.Dispose(); +#endif + foreach (var servicesValue in _services.Values) { await Disposer.DisposeAsync(servicesValue); @@ -132,6 +137,7 @@ private T Register(T t) public object? GetService(Type serviceType) { - return _services.GetValueOrDefault(serviceType); + _services.TryGetValue(serviceType, out object? result); + return result; } } \ No newline at end of file diff --git a/TUnit.Engine/Framework/TUnitTestFramework.cs b/TUnit.Engine/Framework/TUnitTestFramework.cs index 1d5cdd4515..0153f42c2d 100644 --- a/TUnit.Engine/Framework/TUnitTestFramework.cs +++ b/TUnit.Engine/Framework/TUnitTestFramework.cs @@ -52,10 +52,12 @@ public async Task ExecuteRequestAsync(ExecuteRequestContext context) var stringFilter = serviceProvider.FilterParser.GetTestFilter(context); + var logger = serviceProvider.Logger; + GlobalContext.Current = new GlobalContext { TestFilter = stringFilter, - GlobalLogger = serviceProvider.Logger + GlobalLogger = logger }; serviceProvider.StandardOutConsoleInterceptor.Initialize(); @@ -94,10 +96,14 @@ public async Task ExecuteRequestAsync(ExecuteRequestContext context) { if(beforeSessionHook.IsSynchronous) { + await logger.LogDebugAsync("Executing synchronous [Before(TestSession)] hook"); + beforeSessionHook.Execute(testSessionContext, context.CancellationToken); } else { + await logger.LogDebugAsync("Executing asynchronous [Before(TestSession)] hook"); + await beforeSessionHook.ExecuteAsync(testSessionContext, context.CancellationToken); } } @@ -114,10 +120,14 @@ await serviceProvider.TestsExecutor.ExecuteAsync(filteredTests, runTestExecution { if(afterSessionHook.IsSynchronous) { + await logger.LogDebugAsync("Executing synchronous [After(TestSession)] hook"); + afterSessionHook.Execute(testSessionContext, context.CancellationToken); } else { + await logger.LogDebugAsync("Executing asynchronous [After(TestSession)] hook"); + await afterSessionHook.ExecuteAsync(testSessionContext, context.CancellationToken); } } @@ -135,11 +145,11 @@ await serviceProvider.TestsExecutor.ExecuteAsync(filteredTests, runTestExecution catch (Exception e) when (e is TaskCanceledException or OperationCanceledException && context.CancellationToken.IsCancellationRequested) { - await serviceProvider.Logger.LogErrorAsync("The test run was cancelled."); + await logger.LogErrorAsync("The test run was cancelled."); } catch (Exception e) { - await serviceProvider.Logger.LogErrorAsync(e); + await logger.LogErrorAsync(e); await context.MessageBus.PublishAsync( dataProducer: this, diff --git a/TUnit.Engine/Helpers/ExceptionsHelper.cs b/TUnit.Engine/Helpers/ExceptionsHelper.cs index 9c94be0bf0..66cc98a597 100644 --- a/TUnit.Engine/Helpers/ExceptionsHelper.cs +++ b/TUnit.Engine/Helpers/ExceptionsHelper.cs @@ -10,7 +10,7 @@ public static void ThrowIfAny(IReadOnlyList exceptions) { if (exceptions.Count == 1) { - ExceptionDispatchInfo.Throw(exceptions[0]); + ExceptionDispatchInfo.Capture(exceptions[0]).Throw(); } if (exceptions.Count > 1) diff --git a/TUnit.Engine/Hooks/AssemblyHookOrchestrator.cs b/TUnit.Engine/Hooks/AssemblyHookOrchestrator.cs index a66559cff9..075691d407 100644 --- a/TUnit.Engine/Hooks/AssemblyHookOrchestrator.cs +++ b/TUnit.Engine/Hooks/AssemblyHookOrchestrator.cs @@ -14,7 +14,7 @@ internal class AssemblyHookOrchestrator(InstanceTracker instanceTracker, HooksCo private readonly ConcurrentDictionary _beforeHooksReached = new(); - internal GetOnlyDictionary PreviouslyRunBeforeHooks { get; } = new(); + internal GetOnlyDictionary> PreviouslyRunBeforeHooks { get; } = new(); public IEnumerable> CollectBeforeHooks(Assembly assembly) { diff --git a/TUnit.Engine/Hooks/ClassHookOrchestrator.cs b/TUnit.Engine/Hooks/ClassHookOrchestrator.cs index d093da2353..604e722048 100644 --- a/TUnit.Engine/Hooks/ClassHookOrchestrator.cs +++ b/TUnit.Engine/Hooks/ClassHookOrchestrator.cs @@ -13,7 +13,7 @@ internal class ClassHookOrchestrator(InstanceTracker instanceTracker, HooksColle private readonly ConcurrentDictionary _beforeHooksReached = new(); - internal GetOnlyDictionary PreviouslyRunBeforeHooks { get; } = new(); + internal GetOnlyDictionary> PreviouslyRunBeforeHooks { get; } = new(); public IEnumerable> CollectBeforeHooks(Type testClassType) { diff --git a/TUnit.Engine/Logging/ConsoleInterceptor.cs b/TUnit.Engine/Logging/ConsoleInterceptor.cs index 9bd6cf68ec..64a8c0de81 100644 --- a/TUnit.Engine/Logging/ConsoleInterceptor.cs +++ b/TUnit.Engine/Logging/ConsoleInterceptor.cs @@ -16,12 +16,14 @@ internal abstract class ConsoleInterceptor(ICommandLineOptions commandLineOption private protected abstract void ResetDefault(); +#if NET public override ValueTask DisposeAsync() { ResetDefault(); return ValueTask.CompletedTask; } - +#endif + public override void Flush() { GetOriginalOut().Flush(); @@ -403,37 +405,37 @@ public override void Write(char[] buffer, int index, int count) RedirectedOut?.Write(buffer, index, count); } - public override void Write(ReadOnlySpan buffer) + public override void Write(string? value) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - GetOriginalOut().Write(buffer); + GetOriginalOut().Write(value); } - RedirectedOut?.Write(buffer); + RedirectedOut?.Write(value); } - public override void Write(string? value) + public override async Task WriteAsync(char value) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - GetOriginalOut().Write(value); + await GetOriginalOut().WriteAsync(value); } - RedirectedOut?.Write(value); + await (RedirectedOut?.WriteAsync(value) ?? Task.CompletedTask); } - public override void Write(StringBuilder? value) + public override async Task WriteAsync(char[] buffer, int index, int count) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - GetOriginalOut().Write(value); + await GetOriginalOut().WriteAsync(buffer, index, count); } - RedirectedOut?.Write(value); + await (RedirectedOut?.WriteAsync(buffer, index, count) ?? Task.CompletedTask); } - public override async Task WriteAsync(char value) + public override async Task WriteAsync(string? value) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { @@ -443,34 +445,35 @@ public override async Task WriteAsync(char value) await (RedirectedOut?.WriteAsync(value) ?? Task.CompletedTask); } - public override async Task WriteAsync(char[] buffer, int index, int count) +#if NET + public override void Write(ReadOnlySpan buffer) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - await GetOriginalOut().WriteAsync(buffer, index, count); + GetOriginalOut().Write(buffer); } - await (RedirectedOut?.WriteAsync(buffer, index, count) ?? Task.CompletedTask); + RedirectedOut?.Write(buffer); } - public override async Task WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = new()) + public override void Write(StringBuilder? value) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - await GetOriginalOut().WriteAsync(buffer, cancellationToken); + GetOriginalOut().Write(value); } - await (RedirectedOut?.WriteAsync(buffer, cancellationToken) ?? Task.CompletedTask); + RedirectedOut?.Write(value); } - public override async Task WriteAsync(string? value) + public override async Task WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = new()) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - await GetOriginalOut().WriteAsync(value); + await GetOriginalOut().WriteAsync(buffer, cancellationToken); } - await (RedirectedOut?.WriteAsync(value) ?? Task.CompletedTask); + await (RedirectedOut?.WriteAsync(buffer, cancellationToken) ?? Task.CompletedTask); } public override async Task WriteAsync(StringBuilder? value, CancellationToken cancellationToken = new()) @@ -503,53 +506,54 @@ public override void WriteLine(StringBuilder? value) RedirectedOut?.WriteLine(value); } - public override async Task WriteLineAsync(char value) + public override async Task WriteLineAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = new()) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - await GetOriginalOut().WriteLineAsync(value); + await GetOriginalOut().WriteLineAsync(buffer, cancellationToken); } - await (RedirectedOut?.WriteLineAsync(value) ?? Task.CompletedTask); + await (RedirectedOut?.WriteLineAsync(buffer, cancellationToken) ?? Task.CompletedTask); } - public override async Task WriteLineAsync(char[] buffer, int index, int count) + public override async Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = new()) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - await GetOriginalOut().WriteLineAsync(buffer, index, count); + await GetOriginalOut().WriteLineAsync(value, cancellationToken); } - await (RedirectedOut?.WriteLineAsync(buffer, index, count) ?? Task.CompletedTask); + await (RedirectedOut?.WriteLineAsync(value, cancellationToken) ?? Task.CompletedTask); } +#endif - public override async Task WriteLineAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = new()) + public override async Task WriteLineAsync(char value) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - await GetOriginalOut().WriteLineAsync(buffer, cancellationToken); + await GetOriginalOut().WriteLineAsync(value); } - await (RedirectedOut?.WriteLineAsync(buffer, cancellationToken) ?? Task.CompletedTask); + await (RedirectedOut?.WriteLineAsync(value) ?? Task.CompletedTask); } - public override async Task WriteLineAsync(string? value) + public override async Task WriteLineAsync(char[] buffer, int index, int count) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - await GetOriginalOut().WriteLineAsync(value); + await GetOriginalOut().WriteLineAsync(buffer, index, count); } - await (RedirectedOut?.WriteLineAsync(value) ?? Task.CompletedTask); + await (RedirectedOut?.WriteLineAsync(buffer, index, count) ?? Task.CompletedTask); } - public override async Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = new()) + public override async Task WriteLineAsync(string? value) { if (!commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput)) { - await GetOriginalOut().WriteLineAsync(value, cancellationToken); + await GetOriginalOut().WriteLineAsync(value); } - await (RedirectedOut?.WriteLineAsync(value, cancellationToken) ?? Task.CompletedTask); + await (RedirectedOut?.WriteLineAsync(value) ?? Task.CompletedTask); } } \ No newline at end of file diff --git a/TUnit.Engine/Logging/MTPLoggerAdapter.cs b/TUnit.Engine/Logging/MTPLoggerAdapter.cs index a9f4c02d4a..bec07b2f78 100644 --- a/TUnit.Engine/Logging/MTPLoggerAdapter.cs +++ b/TUnit.Engine/Logging/MTPLoggerAdapter.cs @@ -4,9 +4,9 @@ namespace TUnit.Engine.Logging; internal class MTPLoggerAdapter(global::Microsoft.Testing.Platform.Logging.ILogger logger) : ILogger { - public Task LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter) + public async ValueTask LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter) { - return logger.LogAsync(Map(logLevel), state, exception, formatter); + await logger.LogAsync(Map(logLevel), state, exception, formatter); } public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) diff --git a/TUnit.Engine/Logging/TUnitFrameworkLogger.cs b/TUnit.Engine/Logging/TUnitFrameworkLogger.cs index e8040da148..0f062d1b58 100644 --- a/TUnit.Engine/Logging/TUnitFrameworkLogger.cs +++ b/TUnit.Engine/Logging/TUnitFrameworkLogger.cs @@ -19,8 +19,13 @@ public Task IsEnabledAsync() public string DisplayName => extension.DisplayName; public string Description => extension.Description; - public async Task LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter) + public async ValueTask LogAsync(LogLevel logLevel, TState state, Exception? exception, Func formatter) { + if (!IsEnabled(logLevel)) + { + return; + } + var text = formatter(state, exception); await outputDevice.DisplayAsync(this, new FormattedTextOutputDeviceData(text) @@ -43,6 +48,11 @@ public async Task LogAsync(LogLevel logLevel, TState state, Exception? e public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) { + if (!IsEnabled(logLevel)) + { + return; + } + var text = formatter(state, exception); outputDevice.DisplayAsync(this, new FormattedTextOutputDeviceData(text) diff --git a/TUnit.Engine/Models/ConstraintKeysCollection.cs b/TUnit.Engine/Models/ConstraintKeysCollection.cs index 3e3bc1a54d..4c1a4d1e2c 100644 --- a/TUnit.Engine/Models/ConstraintKeysCollection.cs +++ b/TUnit.Engine/Models/ConstraintKeysCollection.cs @@ -3,7 +3,10 @@ namespace TUnit.Engine.Models; internal class ConstraintKeysCollection(IReadOnlyList constraintKeys) - : IReadOnlyList, IEquatable + : IReadOnlyList, + IEquatable, + IComparable, + IComparable { private readonly IReadOnlyList _constraintKeys = constraintKeys; @@ -27,6 +30,16 @@ public bool Equals(ConstraintKeysCollection? other) return _constraintKeys.Intersect(other._constraintKeys).Any(); } + public int CompareTo(ConstraintKeysCollection? other) + { + if (Equals(other, null)) + { + return 0; + } + + return -1; + } + public override bool Equals(object? obj) { if (ReferenceEquals(null, obj)) @@ -52,6 +65,11 @@ public override int GetHashCode() return 1; } + public int CompareTo(object? obj) + { + return CompareTo(obj as ConstraintKeysCollection); + } + public static bool operator ==(ConstraintKeysCollection? left, ConstraintKeysCollection? right) { return Equals(left, right); diff --git a/TUnit.Engine/PolyfillExtensions.cs b/TUnit.Engine/PolyfillExtensions.cs new file mode 100644 index 0000000000..43b0449301 --- /dev/null +++ b/TUnit.Engine/PolyfillExtensions.cs @@ -0,0 +1,11 @@ +namespace TUnit.Assertions.UnitTests; + +internal static class PolyfillExtensions +{ + internal static string ReplaceLineEndings(this string value, string replacement) + { + return value.Replace("\r\n", replacement) + .Replace("\n", replacement) + .Replace("\r", replacement); + } +} diff --git a/TUnit.Engine/PriorityQueue.cs b/TUnit.Engine/PriorityQueue.cs new file mode 100644 index 0000000000..0d9787d6b8 --- /dev/null +++ b/TUnit.Engine/PriorityQueue.cs @@ -0,0 +1,115 @@ +using System.Diagnostics.CodeAnalysis; + +#if !NET + +namespace TUnit.Engine +{ + public class PriorityQueue where TPriority : IComparable + { + private readonly List _elements = []; + + private struct Element(TElement value, TPriority priority) + { + public readonly TElement Value = value; + public readonly TPriority Priority = priority; + } + + public int Count => _elements.Count; + + public void Enqueue(TElement value, TPriority priority) + { + var element = new Element(value, priority); + _elements.Add(element); + HeapifyUp(_elements.Count - 1); + } + + public TElement Dequeue() + { + if (_elements.Count == 0) + { + throw new InvalidOperationException("The priority queue is empty."); + } + + var element = _elements[0]; + _elements[0] = _elements[^1]; + _elements.RemoveAt(_elements.Count - 1); + HeapifyDown(0); + + return element.Value; + } + + public bool TryDequeue([NotNullWhen(true)] out TElement? value, [NotNullWhen(true)] out TPriority? priority) + { + if (_elements.Count == 0) + { + value = default; + priority = default; + return false; + } + + var element = _elements[0]; + _elements[0] = _elements[^1]; + _elements.RemoveAt(_elements.Count - 1); + HeapifyDown(0); + + value = element.Value!; + priority = element.Priority; + return true; + } + + public TElement Peek() + { + if (_elements.Count == 0) + { + throw new InvalidOperationException("The priority queue is empty."); + } + + return _elements[0].Value; + } + + private void HeapifyUp(int index) + { + while (index > 0) + { + var parentIndex = (index - 1) / 2; + if (_elements[index].Priority.CompareTo(_elements[parentIndex].Priority) >= 0) + { + break; + } + + Swap(index, parentIndex); + index = parentIndex; + } + } + + private void HeapifyDown(int index) + { + while (index < _elements.Count / 2) + { + var leftChildIndex = 2 * index + 1; + var rightChildIndex = 2 * index + 2; + var smallestChildIndex = leftChildIndex; + + if (rightChildIndex < _elements.Count && _elements[rightChildIndex].Priority.CompareTo(_elements[leftChildIndex].Priority) < 0) + { + smallestChildIndex = rightChildIndex; + } + + if (_elements[index].Priority.CompareTo(_elements[smallestChildIndex].Priority) <= 0) + { + break; + } + + Swap(index, smallestChildIndex); + index = smallestChildIndex; + } + } + + private void Swap(int index1, int index2) + { + (_elements[index1], _elements[index2]) = (_elements[index2], _elements[index1]); + } + } +} + +#endif diff --git a/TUnit.Engine/Services/Counter.cs b/TUnit.Engine/Services/Counter.cs index 14925a4315..5e1b5aa2ff 100644 --- a/TUnit.Engine/Services/Counter.cs +++ b/TUnit.Engine/Services/Counter.cs @@ -6,7 +6,7 @@ namespace TUnit.Engine.Services; public class Counter { private readonly Lock _locker = new(); - + private int _count; public int Increment() diff --git a/TUnit.Engine/Services/OnEndExecutor.cs b/TUnit.Engine/Services/OnEndExecutor.cs index 110de64fe0..cd41eeb80d 100644 --- a/TUnit.Engine/Services/OnEndExecutor.cs +++ b/TUnit.Engine/Services/OnEndExecutor.cs @@ -36,11 +36,12 @@ private async Task WriteJsonOutputFile(TestSessionContext? testSessionContext) { var path = Path.Combine(Environment.CurrentDirectory, GetFilename()); - await using var file = File.Create(path); + using var file = File.Create(path); var jsonOutput = GetJsonOutput(testSessionContext); await JsonSerializer.SerializeAsync(file, jsonOutput, JsonContext.Default.TestSessionJson); + await file.FlushAsync(); await logger.LogInformationAsync($"TUnit JSON output saved to: {path}"); } diff --git a/TUnit.Engine/Services/SingleTestExecutor.cs b/TUnit.Engine/Services/SingleTestExecutor.cs index f5b671ffac..e4a2eec117 100644 --- a/TUnit.Engine/Services/SingleTestExecutor.cs +++ b/TUnit.Engine/Services/SingleTestExecutor.cs @@ -98,7 +98,7 @@ private async Task ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionF // But users may want to set AsyncLocal values, and so the method must be a parent/ancestor of the method that starts the test! // So actually refactoring these into other methods would mean they wouldn't be a parent/ancestor and would break async local! var assemblyHooksTaskCompletionSource = assemblyHookOrchestrator.PreviouslyRunBeforeHooks.GetOrAdd(testContext.TestDetails.ClassType.Assembly, - _ => new TaskCompletionSource(), out var assemblyHooksTaskPreviouslyExisted); + _ => new TaskCompletionSource(), out var assemblyHooksTaskPreviouslyExisted); if (assemblyHooksTaskPreviouslyExisted) { @@ -119,16 +119,20 @@ private async Task ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionF { if (beforeHook.IsSynchronous) { + await logger.LogDebugAsync("Executing synchronous [Before(Assembly)] hook"); + beforeHook.Execute(assemblyHookContext, CancellationToken.None); } else { + await logger.LogDebugAsync("Executing asynchronous [Before(Assembly)] hook"); + await beforeHook.ExecuteAsync(assemblyHookContext, CancellationToken.None); } } AssemblyHookContext.Current = null; - assemblyHooksTaskCompletionSource.SetResult(); + assemblyHooksTaskCompletionSource.SetResult(false); } catch (Exception e) { @@ -138,7 +142,7 @@ private async Task ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionF } var classHooksTaskCompletionSource = classHookOrchestrator.PreviouslyRunBeforeHooks.GetOrAdd(testContext.TestDetails.ClassType, - _ => new TaskCompletionSource(), out var classHooksTaskPreviouslyExisted); + _ => new TaskCompletionSource(), out var classHooksTaskPreviouslyExisted); if (classHooksTaskPreviouslyExisted) { @@ -158,16 +162,20 @@ private async Task ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionF { if (beforeHook.IsSynchronous) { + await logger.LogDebugAsync("Executing synchronous [Before(Class)] hook"); + beforeHook.Execute(classHookContext, CancellationToken.None); } else { + await logger.LogDebugAsync("Executing asynchronous [Before(Class)] hook"); + await beforeHook.ExecuteAsync(classHookContext, CancellationToken.None); } } ClassHookContext.Current = null; - classHooksTaskCompletionSource.SetResult(); + classHooksTaskCompletionSource.SetResult(false); } catch (Exception e) { @@ -180,6 +188,8 @@ private async Task ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionF foreach (var testStartEventsObject in testContext.GetTestStartEventObjects()) { + await logger.LogDebugAsync("Executing ITestStartEventReceivers"); + await testStartEventsObject.OnTestStart(new BeforeTestContext(testContext.InternalDiscoveredTest)); testStartEventsObject.OnTestStartSynchronous(new BeforeTestContext(testContext.InternalDiscoveredTest)); } @@ -198,6 +208,7 @@ private async Task ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionF } catch (Exception e) { + await logger.LogDebugAsync($"Error in test: {e}"); testContext.SetResult(e); throw; } @@ -216,7 +227,7 @@ private async Task ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionF { Status.Passed => messageBus.Passed(test.TestContext, start.GetValueOrDefault()), Status.Failed => messageBus.Failed(test.TestContext, result.Exception!, start.GetValueOrDefault()), - _ => ValueTask.CompletedTask, + _ => default, }; await task; @@ -231,7 +242,7 @@ private Task RegisterIfNotAlready(TestContext testContext) if (!testContext.IsRegistered) { return testRegistrar.RegisterInstance(testContext.InternalDiscoveredTest, - _ => ValueTask.CompletedTask); + _ => default); } return Task.CompletedTask; @@ -247,6 +258,8 @@ private async Task RunCleanUps(DiscoveredTest test, TestContext testContext, { foreach (var testEndEventsObject in testContext.GetTestEndEventObjects()) { + await logger.LogDebugAsync("Executing ITestEndEventReceivers"); + await RunHelpers.RunValueTaskSafelyAsync(() => testEndEventsObject.OnTestEnd(testContext), cleanUpExceptions); } @@ -255,6 +268,8 @@ await RunHelpers.RunValueTaskSafelyAsync(() => testEndEventsObject.OnTestEnd(tes { foreach (var testSkippedEventReceiver in testContext.GetTestSkippedEventObjects()) { + await logger.LogDebugAsync("Executing ITestSkippedEventReceivers"); + await RunHelpers.RunValueTaskSafelyAsync(() => testSkippedEventReceiver.OnTestSkipped(testContext), cleanUpExceptions); } @@ -290,10 +305,14 @@ private async Task ExecuteStaticAfterHooks(DiscoveredTest test, TestContext test { if(afterHook.IsSynchronous) { + await logger.LogDebugAsync("Executing synchronous [After(Class)] hook"); + RunHelpers.RunSafely(() => afterHook.Execute(classHookContext, CancellationToken.None), cleanUpExceptions); } else { + await logger.LogDebugAsync("Executing asynchronous [After(Class)] hook"); + await RunHelpers.RunSafelyAsync(() => afterHook.ExecuteAsync(classHookContext, CancellationToken.None), cleanUpExceptions); } } @@ -309,10 +328,14 @@ private async Task ExecuteStaticAfterHooks(DiscoveredTest test, TestContext test { if(afterHook.IsSynchronous) { + await logger.LogDebugAsync("Executing synchronous [After(Assembly)] hook"); + RunHelpers.RunSafely(() => afterHook.Execute(assemblyHookContext, CancellationToken.None), cleanUpExceptions); } else { + await logger.LogDebugAsync("Executing asynchronous [After(Assembly)] hook"); + await RunHelpers.RunSafelyAsync(() => afterHook.ExecuteAsync(assemblyHookContext, CancellationToken.None), cleanUpExceptions); } } @@ -325,6 +348,8 @@ private async Task ExecuteStaticAfterHooks(DiscoveredTest test, TestContext test var allTests = testSessionContext.AllTests; foreach (var testEndEventsObject in allTests.SelectMany(tc => tc.GetLastTestInTestSessionEventObjects())) { + await logger.LogDebugAsync("Executing ILastTestInTestSessionEventReceivers"); + await RunHelpers.RunValueTaskSafelyAsync( () => testEndEventsObject.OnLastTestInTestSession(testSessionContext, testContext), cleanUpExceptions); diff --git a/TUnit.Engine/Services/TUnitTestDiscoverer.cs b/TUnit.Engine/Services/TUnitTestDiscoverer.cs index 25bc8f257b..0ec8f8ee40 100644 --- a/TUnit.Engine/Services/TUnitTestDiscoverer.cs +++ b/TUnit.Engine/Services/TUnitTestDiscoverer.cs @@ -1,10 +1,11 @@ using Microsoft.Testing.Platform.Extensions; using Microsoft.Testing.Platform.Extensions.Messages; using Microsoft.Testing.Platform.Extensions.TestFramework; -using Microsoft.Testing.Platform.Logging; using Microsoft.Testing.Platform.Requests; using TUnit.Core; +using TUnit.Core.Logging; using TUnit.Engine.Hooks; +using TUnit.Engine.Logging; using TUnit.Engine.Models; namespace TUnit.Engine.Services; @@ -17,11 +18,9 @@ internal class TUnitTestDiscoverer( TestRegistrar testRegistrar, TestDiscoveryHookOrchestrator testDiscoveryHookOrchestrator, ITUnitMessageBus tUnitMessageBus, - ILoggerFactory loggerFactory, + TUnitFrameworkLogger logger, IExtension extension) : IDataProducer { - private readonly ILogger _logger = loggerFactory.CreateLogger(); - private IReadOnlyCollection? _cachedTests; public IReadOnlyCollection GetCachedTests() @@ -39,7 +38,7 @@ public async Task FilterTests(ExecuteRequestContext context, strin var filteredTests = testFilterService.FilterTests(executionRequest?.Filter, allDiscoveredTests).ToArray(); - await _logger.LogTraceAsync($"Found {filteredTests.Length} tests after filtering."); + await logger.LogTraceAsync($"Found {filteredTests.Length} tests after filtering."); var organisedTests = testGrouper.OrganiseTests(filteredTests); @@ -72,10 +71,14 @@ private async Task> DiscoverTests() { if(beforeDiscoveryHook.IsSynchronous) { + await logger.LogDebugAsync("Executing synchronous [Before(TestDiscovery)] hook"); + beforeDiscoveryHook.Execute(beforeContext, CancellationToken.None); } else { + await logger.LogDebugAsync("Executing asynchronous [Before(TestDiscovery)] hook"); + await beforeDiscoveryHook.ExecuteAsync(beforeContext, CancellationToken.None); } } @@ -89,10 +92,14 @@ private async Task> DiscoverTests() { if(afterDiscoveryHook.IsSynchronous) { + await logger.LogDebugAsync("Executing asynchronous [After(TestDiscovery)] hook"); + afterDiscoveryHook.Execute(afterContext, CancellationToken.None); } else { + await logger.LogDebugAsync("Executing asynchronous [After(TestDiscovery)] hook"); + await afterDiscoveryHook.ExecuteAsync(afterContext, CancellationToken.None); } } diff --git a/TUnit.Engine/Services/TestInvoker.cs b/TUnit.Engine/Services/TestInvoker.cs index 2444067aa6..d5ee322067 100644 --- a/TUnit.Engine/Services/TestInvoker.cs +++ b/TUnit.Engine/Services/TestInvoker.cs @@ -1,13 +1,16 @@ -using TUnit.Core; +using System.Diagnostics; +using TUnit.Core; using TUnit.Core.Helpers; using TUnit.Core.Interfaces; +using TUnit.Core.Logging; using TUnit.Engine.Extensions; using TUnit.Engine.Helpers; using TUnit.Engine.Hooks; +using TUnit.Engine.Logging; namespace TUnit.Engine.Services; -internal class TestInvoker(TestHookOrchestrator testHookOrchestrator, Disposer disposer) +internal class TestInvoker(TestHookOrchestrator testHookOrchestrator, TUnitFrameworkLogger logger, Disposer disposer) { private readonly SemaphoreSlim _consoleStandardOutLock = new(1, 1); @@ -17,6 +20,8 @@ public async Task Invoke(DiscoveredTest discoveredTest, CancellationToken cancel { if (discoveredTest.TestDetails.ClassInstance is IAsyncInitializer asyncInitializer) { + await logger.LogDebugAsync("Initializing IAsyncInitializer test class..."); + await asyncInitializer.InitializeAsync(); } @@ -32,18 +37,24 @@ public async Task Invoke(DiscoveredTest discoveredTest, CancellationToken cancel { if (executableHook.IsSynchronous) { + await logger.LogDebugAsync("Executing synchronous [Before(Test)] hook"); + Timings.Record($"Before(Test): {executableHook.Name}", discoveredTest.TestContext, () => executableHook.Execute(discoveredTest.TestContext, cancellationToken) ); } else { + await logger.LogDebugAsync("Executing asynchronous [Before(Test)] hook"); + await Timings.Record($"Before(Test): {executableHook.Name}", discoveredTest.TestContext, () => executableHook.ExecuteAsync(discoveredTest.TestContext, cancellationToken) ); } } + await logger.LogDebugAsync("Executing test body"); + await Timings.Record("Test Body", discoveredTest.TestContext, () => discoveredTest.ExecuteTest(cancellationToken)); @@ -68,24 +79,30 @@ private async ValueTask DisposeTest(TestContext testContext, List cle { if (executableHook.IsSynchronous) { + await logger.LogDebugAsync("Executing synchronous [After(Test)] hook"); + Timings.Record($"After(Test): {executableHook.Name}", testContext, () => executableHook.Execute(testContext, CancellationToken.None) ); } else { + await logger.LogDebugAsync("Executing asynchronous [After(Test)] hook"); + await Timings.Record($"After(Test): {executableHook.Name}", testContext, () => executableHook.ExecuteAsync(testContext, CancellationToken.None) ); } } + await logger.LogDebugAsync("Disposing test class"); await RunHelpers.RunValueTaskSafelyAsync(() => disposer.DisposeAsync(testContext.TestDetails.ClassInstance), cleanUpExceptions); await _consoleStandardOutLock.WaitAsync(); try { + await logger.LogDebugAsync("Disposing test context"); await disposer.DisposeAsync(testContext); } finally diff --git a/TUnit.Engine/Services/TestsExecutor.cs b/TUnit.Engine/Services/TestsExecutor.cs index 4d5191c24d..4e2aad7ec7 100644 --- a/TUnit.Engine/Services/TestsExecutor.cs +++ b/TUnit.Engine/Services/TestsExecutor.cs @@ -2,6 +2,7 @@ using Microsoft.Testing.Platform.CommandLine; using Microsoft.Testing.Platform.Extensions.TestFramework; using Microsoft.Testing.Platform.Requests; +using Polyfills; using TUnit.Core; using TUnit.Engine.CommandLineProviders; using TUnit.Engine.Logging; @@ -17,7 +18,7 @@ internal class TestsExecutor private readonly EngineCancellationToken _engineCancellationToken; private readonly Counter _executionCounter = new(); - private readonly TaskCompletionSource _onFinished = new(); + private readonly TaskCompletionSource _onFinished = new(); private readonly int _maximumParallelTests; @@ -37,14 +38,17 @@ public TestsExecutor(SingleTestExecutor singleTestExecutor, { if (count == 0) { - _onFinished.TrySetResult(); + _onFinished.TrySetResult(false); } }; } public async Task ExecuteAsync(GroupedTests tests, ITestExecutionFilter? filter, ExecuteRequestContext context) { - await using var _ = _engineCancellationToken.Token.Register(() => _onFinished.TrySetCanceled()); + using var _ = _engineCancellationToken.Token.Register(() => + { + _onFinished.TrySetCanceled(); + }); try { @@ -91,10 +95,13 @@ private async Task ProcessParallelGroups(IDictionary tests) { - while (tests.TryDequeue(out var testInformation, out _)) + await Task.Run(async delegate { - await ProcessTest(testInformation, filter, context, context.CancellationToken); - } + while (tests.TryDequeue(out var testInformation, out _)) + { + await ProcessTest(testInformation, filter, context, context.CancellationToken); + } + }); } private async Task ProcessParallelTests(IEnumerable queue, ITestExecutionFilter? filter, @@ -107,13 +114,20 @@ private async Task ProcessCollection(IEnumerable queue, ITestExecutionFilter? filter, ExecuteRequestContext context) { +#if NET await Parallel.ForEachAsync(queue, new ParallelOptions { MaxDegreeOfParallelism = _maximumParallelTests, CancellationToken = context.CancellationToken }, (test, token) => ProcessTest(test, filter, context, token)); +#else + await queue + .ForEachAsync(test => ProcessTest(test, filter, context, context.CancellationToken)) + .ProcessInParallel(_maximumParallelTests); +#endif } +#if NET private async ValueTask ProcessTest(DiscoveredTest test, ITestExecutionFilter? filter, ExecuteRequestContext context, CancellationToken cancellationToken) { @@ -129,6 +143,23 @@ private async ValueTask ProcessTest(DiscoveredTest test, } } } +#else + private async Task ProcessTest(DiscoveredTest test, + ITestExecutionFilter? filter, ExecuteRequestContext context, CancellationToken cancellationToken) + { + try + { + await _singleTestExecutor.ExecuteTestAsync(test, filter, context, false); + } + catch + { + if (_commandLineOptions.IsOptionSet(FailFastCommandProvider.FailFast)) + { + _engineCancellationToken.CancellationTokenSource.Cancel(); + } + } + } +#endif private int GetParallelTestsLimit() { diff --git a/TUnit.Engine/TUnit.Engine.csproj b/TUnit.Engine/TUnit.Engine.csproj index d0e44f6b56..d63664fd72 100644 --- a/TUnit.Engine/TUnit.Engine.csproj +++ b/TUnit.Engine/TUnit.Engine.csproj @@ -1,13 +1,16 @@  + false + true false false preview + LAUNCH_DEBUGGER - + @@ -25,4 +28,4 @@ - \ No newline at end of file + diff --git a/TUnit.Engine/TUnitMessageBus.cs b/TUnit.Engine/TUnitMessageBus.cs index 31ce1e1556..809d733ace 100644 --- a/TUnit.Engine/TUnitMessageBus.cs +++ b/TUnit.Engine/TUnitMessageBus.cs @@ -3,6 +3,7 @@ using Microsoft.Testing.Platform.Extensions.Messages; using Microsoft.Testing.Platform.Extensions.TestFramework; using Microsoft.Testing.Platform.TestHost; +using Polyfills; using TUnit.Core; using TUnit.Engine.Extensions; #pragma warning disable TPEXP diff --git a/TUnit.Engine/Verify.cs b/TUnit.Engine/Verify.cs new file mode 100644 index 0000000000..b654439fcc --- /dev/null +++ b/TUnit.Engine/Verify.cs @@ -0,0 +1,15 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; + +namespace TUnit; + +static class Verify +{ + internal static void ArgNotNull([NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null) + { + if (argument is null) + { + throw new ArgumentNullException(paramName); + } + } +} diff --git a/TUnit.Pipeline/Modules/PublishAOTModule.cs b/TUnit.Pipeline/Modules/PublishAOTModule.cs index 36010b5623..d589b2cbfb 100644 --- a/TUnit.Pipeline/Modules/PublishAOTModule.cs +++ b/TUnit.Pipeline/Modules/PublishAOTModule.cs @@ -12,7 +12,12 @@ namespace TUnit.Pipeline.Modules; public class PublishAOTModule : Module { public override ModuleRunType ModuleRunType => ModuleRunType.AlwaysRun; - + + protected override Task ShouldSkip(IPipelineContext context) + { + return Task.FromResult(Environment.GetEnvironmentVariable("NET_VERSION") == "net472"); + } + protected override async Task ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken) { var testProject = context.Git().RootDirectory!.FindFile(x => x.Name == "TUnit.TestProject.csproj").AssertExists(); diff --git a/TUnit.Pipeline/Modules/PublishSingleFileModule.cs b/TUnit.Pipeline/Modules/PublishSingleFileModule.cs index d0734cbdef..ac3a4d0025 100644 --- a/TUnit.Pipeline/Modules/PublishSingleFileModule.cs +++ b/TUnit.Pipeline/Modules/PublishSingleFileModule.cs @@ -15,6 +15,11 @@ public class PublishSingleFileModule : Module { public override ModuleRunType ModuleRunType => ModuleRunType.AlwaysRun; + protected override Task ShouldSkip(IPipelineContext context) + { + return Task.FromResult(Environment.GetEnvironmentVariable("NET_VERSION") == "net472"); + } + protected override async Task ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken) { var testProject = context.Git().RootDirectory!.FindFile(x => x.Name == "TUnit.TestProject.csproj").AssertExists(); diff --git a/TUnit.Pipeline/Modules/RunAssertionsTestsModule.cs b/TUnit.Pipeline/Modules/RunAssertionsTestsModule.cs index b052e01960..9e6ffc3ac5 100644 --- a/TUnit.Pipeline/Modules/RunAssertionsTestsModule.cs +++ b/TUnit.Pipeline/Modules/RunAssertionsTestsModule.cs @@ -20,7 +20,7 @@ public class RunAssertionsTestsModule : Module { NoBuild = true, Configuration = Configuration.Release, - Framework = "net8.0" + Framework = Environment.GetEnvironmentVariable("NET_VERSION") }, cancellationToken); } } \ No newline at end of file diff --git a/TUnit.Pipeline/Modules/RunAssertionsUnitTestsModule.cs b/TUnit.Pipeline/Modules/RunAssertionsUnitTestsModule.cs index 43666b5172..71b8058c1c 100644 --- a/TUnit.Pipeline/Modules/RunAssertionsUnitTestsModule.cs +++ b/TUnit.Pipeline/Modules/RunAssertionsUnitTestsModule.cs @@ -20,7 +20,7 @@ public class RunAssertionsUnitTestsModule : Module { NoBuild = true, Configuration = Configuration.Release, - Framework = "net8.0" + Framework = Environment.GetEnvironmentVariable("NET_VERSION") }, cancellationToken); } } \ No newline at end of file diff --git a/TUnit.Pipeline/Modules/RunEngineTestsModule.cs b/TUnit.Pipeline/Modules/RunEngineTestsModule.cs index 0b3b406fe8..d566c027df 100644 --- a/TUnit.Pipeline/Modules/RunEngineTestsModule.cs +++ b/TUnit.Pipeline/Modules/RunEngineTestsModule.cs @@ -23,7 +23,7 @@ public class RunEngineTestsModule : Module Project = project.Name, NoBuild = true, Configuration = Configuration.Release, - Framework = "net8.0", + Framework = "net9.0", WorkingDirectory = project.Folder! }, cancellationToken); } diff --git a/TUnit.Pipeline/Modules/RunPlaywrightTestsModule.cs b/TUnit.Pipeline/Modules/RunPlaywrightTestsModule.cs index 40a282ed54..67c4f6883c 100644 --- a/TUnit.Pipeline/Modules/RunPlaywrightTestsModule.cs +++ b/TUnit.Pipeline/Modules/RunPlaywrightTestsModule.cs @@ -20,7 +20,7 @@ public class RunPlaywrightTestsModule : Module { NoBuild = true, Configuration = Configuration.Release, - Framework = "net8.0" + Framework = Environment.GetEnvironmentVariable("NET_VERSION"), }, cancellationToken); } } \ No newline at end of file diff --git a/TUnit.Pipeline/Modules/RunUnitTestsModule.cs b/TUnit.Pipeline/Modules/RunUnitTestsModule.cs index 2890185364..2e173869d8 100644 --- a/TUnit.Pipeline/Modules/RunUnitTestsModule.cs +++ b/TUnit.Pipeline/Modules/RunUnitTestsModule.cs @@ -20,7 +20,7 @@ public class RunUnitTestsModule : Module { NoBuild = true, Configuration = Configuration.Release, - Framework = "net8.0" + Framework = Environment.GetEnvironmentVariable("NET_VERSION"), }, cancellationToken); } } \ No newline at end of file diff --git a/TUnit.Pipeline/Modules/TestNugetPackageModule.cs b/TUnit.Pipeline/Modules/TestNugetPackageModule.cs index d49746050e..9fed7ad0c7 100644 --- a/TUnit.Pipeline/Modules/TestNugetPackageModule.cs +++ b/TUnit.Pipeline/Modules/TestNugetPackageModule.cs @@ -14,8 +14,16 @@ namespace TUnit.Pipeline.Modules; [DependsOn] public class TestNugetPackageModule : Module { - private readonly string[] _frameworks = ["net8.0", "net9.0"]; + private readonly List _frameworks = ["net8.0", "net9.0"]; + public TestNugetPackageModule() + { + if (Environment.GetEnvironmentVariable("NET_VERSION") == "net472") + { + _frameworks.Add("net472"); + } + } + protected override async Task ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken) { diff --git a/TUnit.Playwright.Tests/TUnit.Playwright.Tests.csproj b/TUnit.Playwright.Tests/TUnit.Playwright.Tests.csproj index d6d5b811ec..6e0897546d 100644 --- a/TUnit.Playwright.Tests/TUnit.Playwright.Tests.csproj +++ b/TUnit.Playwright.Tests/TUnit.Playwright.Tests.csproj @@ -1,6 +1,7 @@  + true false true Exe diff --git a/TUnit.Playwright/PlaywrightSkipAttribute.cs b/TUnit.Playwright/PlaywrightSkipAttribute.cs index 55f2ddedb4..2fd29ab3a7 100644 --- a/TUnit.Playwright/PlaywrightSkipAttribute.cs +++ b/TUnit.Playwright/PlaywrightSkipAttribute.cs @@ -36,7 +36,8 @@ public override Task ShouldSkip(BeforeTestContext context) return Task.FromResult(_combinations.Any(combination => { - var requirements = Enum.GetValues().Where(x => combination.HasFlag(x)); + var targets = Enum.GetValues(typeof(Targets)).OfType(); + var requirements = targets.Where(x => combination.HasFlag(x)); return requirements.All(flag => flag switch { diff --git a/TUnit.Playwright/TUnit.Playwright.csproj b/TUnit.Playwright/TUnit.Playwright.csproj index 22e607a9df..e51b14a7ee 100644 --- a/TUnit.Playwright/TUnit.Playwright.csproj +++ b/TUnit.Playwright/TUnit.Playwright.csproj @@ -1,16 +1,22 @@  - - - + + true + - - - - - - - - + + + - + + + + + + + + + + \ No newline at end of file diff --git a/TUnit.Playwright/WorkerAwareTest.cs b/TUnit.Playwright/WorkerAwareTest.cs index 9555ab81a7..b1ecd966b1 100644 --- a/TUnit.Playwright/WorkerAwareTest.cs +++ b/TUnit.Playwright/WorkerAwareTest.cs @@ -77,6 +77,8 @@ public ValueTask OnTestRegistered(TestRegisteredContext context) context.SetParallelLimiter(new DefaultPlaywrightParallelLimiter()); } - return ValueTask.CompletedTask; + return default; } + + int IEventReceiver.Order => 0; } diff --git a/TUnit.TestProject.Library/TUnit.TestProject.Library.csproj b/TUnit.TestProject.Library/TUnit.TestProject.Library.csproj index 297a1a0e86..93bcab00ed 100644 --- a/TUnit.TestProject.Library/TUnit.TestProject.Library.csproj +++ b/TUnit.TestProject.Library/TUnit.TestProject.Library.csproj @@ -1,6 +1,7 @@  + true enable enable false diff --git a/TUnit.TestProject/AfterTestAttributeTests.cs b/TUnit.TestProject/AfterTestAttributeTests.cs index 77ea129063..b03935951e 100644 --- a/TUnit.TestProject/AfterTestAttributeTests.cs +++ b/TUnit.TestProject/AfterTestAttributeTests.cs @@ -1,6 +1,7 @@ using TUnit.Assertions; using TUnit.Assertions.Extensions; using TUnit.Core.Interfaces; +using TUnit.TestProject.Polyfills; namespace TUnit.TestProject; @@ -20,7 +21,10 @@ public class WriteFileAfterTestAttribute : Attribute, ITestEndEventReceiver public async ValueTask OnTestEnd(TestContext testContext) { Console.WriteLine(@"Writing file inside WriteFileAfterTestAttribute!"); - await File.WriteAllTextAsync(Filename, "Foo!"); + + await FilePolyfill.WriteAllTextAsync(Filename, "Foo!"); } + + public int Order => 0; } } \ No newline at end of file diff --git a/TUnit.TestProject/AfterTests/TestDiscoveryAfterTests.cs b/TUnit.TestProject/AfterTests/TestDiscoveryAfterTests.cs index 44a03d54c9..851574cf48 100644 --- a/TUnit.TestProject/AfterTests/TestDiscoveryAfterTests.cs +++ b/TUnit.TestProject/AfterTests/TestDiscoveryAfterTests.cs @@ -1,5 +1,6 @@ using TUnit.Assertions; using TUnit.Assertions.Extensions; +using TUnit.TestProject.Polyfills; namespace TUnit.TestProject.AfterTests; @@ -14,7 +15,7 @@ public static async Task AfterTestDiscovery(TestDiscoveryContext context) [AfterEvery(TestDiscovery)] public static async Task AfterEveryTestDiscovery(TestDiscoveryContext context) { - await File.WriteAllTextAsync($"TestDiscoveryAfterTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests found"); + await FilePolyfill.WriteAllTextAsync($"TestDiscoveryAfterTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests found"); var test = context.AllTests.First(x => x.TestDetails.TestName == nameof(TestDiscoveryAfterTests.EnsureAfterEveryTestDiscoveryHit)); diff --git a/TUnit.TestProject/AfterTests/TestSessionAfterTests.cs b/TUnit.TestProject/AfterTests/TestSessionAfterTests.cs index 7ec1abebb1..88fc2dceb6 100644 --- a/TUnit.TestProject/AfterTests/TestSessionAfterTests.cs +++ b/TUnit.TestProject/AfterTests/TestSessionAfterTests.cs @@ -1,5 +1,6 @@ using TUnit.Assertions; using TUnit.Assertions.Extensions; +using TUnit.TestProject.Polyfills; namespace TUnit.TestProject.AfterTests; @@ -14,7 +15,7 @@ public static async Task AfterTestSession(TestSessionContext context) [AfterEvery(TestSession)] public static async Task AfterEveryTestSession(TestSessionContext context) { - await File.WriteAllTextAsync($"TestSessionAfterTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests in session"); + await FilePolyfill.WriteAllTextAsync($"TestSessionAfterTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests in session"); var test = context.AllTests.FirstOrDefault(x => x.TestDetails.TestName == nameof(TestSessionAfterTests.PepareForAfterSession)); diff --git a/TUnit.TestProject/AssemblyHooks.cs b/TUnit.TestProject/AssemblyHooks.cs index fb7633002e..cdcc737102 100644 --- a/TUnit.TestProject/AssemblyHooks.cs +++ b/TUnit.TestProject/AssemblyHooks.cs @@ -13,45 +13,54 @@ public static void BeforeHook1() _beforeHook1Calls++; } + +#if NET [Before(Assembly)] public static async Task BeforeHook2(AssemblyHookContext context) { await Assert.That(context.TestCount).IsPositive(); } +#endif [Before(Assembly), Timeout(30_000)] public static void BeforeHook3(CancellationToken cancellationToken) { // Dummy method } - + +#if NET [Before(Assembly), Timeout(30_000)] public static async Task BeforeHook4(AssemblyHookContext context, CancellationToken cancellationToken) { await Assert.That(context.TestCount).IsPositive(); } +#endif [After(Assembly)] public static async Task AfterHook1() { await Assert.That(_beforeHook1Calls).IsEqualTo(1); } - + +#if NET [After(Assembly)] public static async Task AfterHook2(AssemblyHookContext context) { await Assert.That(context.TestCount).IsPositive(); } +#endif [After(Assembly), Timeout(30_000)] public static void AfterHook3(CancellationToken cancellationToken) { // Dummy method } - + +#if NET [After(Assembly), Timeout(30_000)] public static async Task AfterHook4(AssemblyHookContext context, CancellationToken cancellationToken) { await Assert.That(context.TestCount).IsPositive(); } +#endif } \ No newline at end of file diff --git a/TUnit.TestProject/AsyncDisposableFieldTests.cs b/TUnit.TestProject/AsyncDisposableFieldTests.cs index d21cb2672d..9c425c9d6d 100644 --- a/TUnit.TestProject/AsyncDisposableFieldTests.cs +++ b/TUnit.TestProject/AsyncDisposableFieldTests.cs @@ -1,4 +1,6 @@ -namespace TUnit.TestProject; +#if NET + +namespace TUnit.TestProject; public class AsyncDisposableFieldTests { @@ -21,4 +23,5 @@ public void Test1() { // Dummy method } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/TUnit.TestProject/AsyncDisposablePropertyTests.cs b/TUnit.TestProject/AsyncDisposablePropertyTests.cs index 56a97615cb..42d31e5759 100644 --- a/TUnit.TestProject/AsyncDisposablePropertyTests.cs +++ b/TUnit.TestProject/AsyncDisposablePropertyTests.cs @@ -13,9 +13,9 @@ public void Setup() } [After(Test)] - public async Task Blah() + public void Blah() { - await TextWriter!.DisposeAsync(); + TextWriter!.Dispose(); } [Test] diff --git a/TUnit.TestProject/BasicTests.cs b/TUnit.TestProject/BasicTests.cs index 6557ecac7d..bf795b8fba 100644 --- a/TUnit.TestProject/BasicTests.cs +++ b/TUnit.TestProject/BasicTests.cs @@ -17,6 +17,6 @@ public async Task AsynchronousTest() [Test] public async ValueTask ValueTaskAsynchronousTest() { - await ValueTask.CompletedTask; + await new ValueTask(); } } \ No newline at end of file diff --git a/TUnit.TestProject/BeforeTests/TestDiscoveryBeforeTests.cs b/TUnit.TestProject/BeforeTests/TestDiscoveryBeforeTests.cs index b6db49496c..ab4d330c15 100644 --- a/TUnit.TestProject/BeforeTests/TestDiscoveryBeforeTests.cs +++ b/TUnit.TestProject/BeforeTests/TestDiscoveryBeforeTests.cs @@ -1,4 +1,6 @@ -namespace TUnit.TestProject.BeforeTests; +using TUnit.TestProject.Polyfills; + +namespace TUnit.TestProject.BeforeTests; public class TestDiscoveryBeforeHooks { @@ -11,7 +13,7 @@ public static async Task BeforeTestDiscovery(BeforeTestDiscoveryContext context) [BeforeEvery(TestDiscovery)] public static async Task BeforeEveryTestDiscovery(BeforeTestDiscoveryContext context) { - await File.WriteAllTextAsync($"TestDiscoveryBeforeTests{Guid.NewGuid():N}.txt", $"Blah!"); + await FilePolyfill.WriteAllTextAsync($"TestDiscoveryBeforeTests{Guid.NewGuid():N}.txt", $"Blah!"); } } diff --git a/TUnit.TestProject/BeforeTests/TestSessionBeforeTests.cs b/TUnit.TestProject/BeforeTests/TestSessionBeforeTests.cs index aeca8d68b5..c9f9ee9a3c 100644 --- a/TUnit.TestProject/BeforeTests/TestSessionBeforeTests.cs +++ b/TUnit.TestProject/BeforeTests/TestSessionBeforeTests.cs @@ -1,5 +1,6 @@ using TUnit.Assertions; using TUnit.Assertions.Extensions; +using TUnit.TestProject.Polyfills; namespace TUnit.TestProject.BeforeTests; @@ -14,7 +15,7 @@ public static async Task BeforeTestSession(TestSessionContext context) [BeforeEvery(TestSession)] public static async Task BeforeEveryTestSession(TestSessionContext context) { - await File.WriteAllTextAsync($"TestSessionBeforeTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests in session"); + await FilePolyfill.WriteAllTextAsync($"TestSessionBeforeTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests in session"); var test = context.AllTests.FirstOrDefault(x => x.TestDetails.TestName == nameof(TestSessionBeforeTests.EnsureBeforeEveryTestSessionHit)); diff --git a/TUnit.TestProject/Bugs/1304/Tests.cs b/TUnit.TestProject/Bugs/1304/Tests.cs index eac771e992..b96b7821b4 100644 --- a/TUnit.TestProject/Bugs/1304/Tests.cs +++ b/TUnit.TestProject/Bugs/1304/Tests.cs @@ -15,7 +15,7 @@ public class Tests public async Task TryParse_InvalidString_ReturnsFailure(string? input, CancellationToken cancellationToken) { // Act - var success = AccountId.TryParse(input, out var id); + var success = AccountId.TryParse(input!, out var id); // Assert await Assert.That(success).IsFalse(); @@ -67,6 +67,4 @@ public async Task TryParse_ValidString_ReturnsAccountId(string input) public interface IIdentifiable { bool HasValue { get; } - static abstract TId Empty { get; } - static abstract TId New { get; } } \ No newline at end of file diff --git a/TUnit.TestProject/CustomClassDisplayNameTests.cs b/TUnit.TestProject/CustomClassDisplayNameTests.cs index 7ee4c156d1..63ea7de3af 100644 --- a/TUnit.TestProject/CustomClassDisplayNameTests.cs +++ b/TUnit.TestProject/CustomClassDisplayNameTests.cs @@ -1,6 +1,7 @@ using TUnit.Assertions; using TUnit.Assertions.Extensions; using TUnit.Core.Extensions; +using TUnit.TestProject.AfterTests; #pragma warning disable CS9113 // Parameter is unread. diff --git a/TUnit.TestProject/CustomDisplayNameTests.cs b/TUnit.TestProject/CustomDisplayNameTests.cs index 1dbc906a7a..b294e2eb49 100644 --- a/TUnit.TestProject/CustomDisplayNameTests.cs +++ b/TUnit.TestProject/CustomDisplayNameTests.cs @@ -57,7 +57,11 @@ public void OnTestDiscovery(DiscoveredTestContext discoveredTestContext) { discoveredTestContext.SetDisplayName($"{discoveredTestContext.TestDetails.TestName}(REDACTED)"); } + + public int Order => 0; } public static string Method() => "bar"; + + public int Order => 0; } \ No newline at end of file diff --git a/TUnit.TestProject/DependencyInjectionClassConstructor.cs b/TUnit.TestProject/DependencyInjectionClassConstructor.cs index 5f3620cd7a..a3473383fc 100644 --- a/TUnit.TestProject/DependencyInjectionClassConstructor.cs +++ b/TUnit.TestProject/DependencyInjectionClassConstructor.cs @@ -27,4 +27,6 @@ private static IServiceProvider CreateServiceProvider() .AddTransient() .BuildServiceProvider(); } + + public int Order => 0; } \ No newline at end of file diff --git a/TUnit.TestProject/DisposableFieldTests.cs b/TUnit.TestProject/DisposableFieldTests.cs index 201a2dcac7..88d1816587 100644 --- a/TUnit.TestProject/DisposableFieldTests.cs +++ b/TUnit.TestProject/DisposableFieldTests.cs @@ -1,4 +1,6 @@ -namespace TUnit.TestProject; +using System.Net.Http; + +namespace TUnit.TestProject; public class DisposableFieldTests { diff --git a/TUnit.TestProject/DisposablePropertyTests.cs b/TUnit.TestProject/DisposablePropertyTests.cs index b561be01b3..3503807bde 100644 --- a/TUnit.TestProject/DisposablePropertyTests.cs +++ b/TUnit.TestProject/DisposablePropertyTests.cs @@ -1,4 +1,6 @@ -namespace TUnit.TestProject; +using System.Net.Http; + +namespace TUnit.TestProject; public class DisposablePropertyTests { diff --git a/TUnit.TestProject/Dummy/SomeAsyncDisposableClass.cs b/TUnit.TestProject/Dummy/SomeAsyncDisposableClass.cs index 2e7683794e..75b7fa77a0 100644 --- a/TUnit.TestProject/Dummy/SomeAsyncDisposableClass.cs +++ b/TUnit.TestProject/Dummy/SomeAsyncDisposableClass.cs @@ -9,6 +9,6 @@ public class SomeAsyncDisposableClass : IAsyncDisposable public ValueTask DisposeAsync() { IsDisposed = true; - return ValueTask.CompletedTask; + return default; } } \ No newline at end of file diff --git a/TUnit.TestProject/DynamicallyRegisteredTests.cs b/TUnit.TestProject/DynamicallyRegisteredTests.cs index 66850138a7..d325ace747 100644 --- a/TUnit.TestProject/DynamicallyRegisteredTests.cs +++ b/TUnit.TestProject/DynamicallyRegisteredTests.cs @@ -23,7 +23,7 @@ public class DynamicDataGenerator : DataSourceGeneratorAttribute, ITestStar public override IEnumerable> GenerateDataSources(DataGeneratorMetadata dataGeneratorMetadata) { - yield return () => Random.Shared.Next(); + yield return () => new Random().Next(); } public ValueTask OnTestStart(BeforeTestContext beforeTestContext) @@ -33,7 +33,11 @@ public ValueTask OnTestStart(BeforeTestContext beforeTestContext) beforeTestContext.AddLinkedCancellationToken(_cancellationTokenSource.Token); } - return ValueTask.CompletedTask; + return default; + } + + public void OnTestStartSynchronous(BeforeTestContext beforeTestContext) + { } [Experimental("WIP")] @@ -55,7 +59,7 @@ public async ValueTask OnTestEnd(TestContext testContext) // testContext.SuppressReportingResult(); } - await testContext.ReregisterTestWithArguments(methodArguments: [Random.Shared.Next()], + await testContext.ReregisterTestWithArguments(methodArguments: [new Random().Next()], objectBag: new() { ["DynamicDataGeneratorRetry"] = true @@ -67,4 +71,6 @@ private static bool IsReregisteredTest(TestContext testContext) { return testContext.ObjectBag.ContainsKey("DynamicDataGeneratorRetry"); } + + public int Order => 0; } \ No newline at end of file diff --git a/TUnit.TestProject/ExampleTestFixture.cs b/TUnit.TestProject/ExampleTestFixture.cs index ca2e9a400b..e4e32dadbe 100644 --- a/TUnit.TestProject/ExampleTestFixture.cs +++ b/TUnit.TestProject/ExampleTestFixture.cs @@ -49,4 +49,6 @@ private static IServiceProvider CreateServiceProvider() //.AddScoped() //Commenting this line out removes the test from the discovery .BuildServiceProvider(); } + + public int Order => 0; } \ No newline at end of file diff --git a/TUnit.TestProject/FilterByDynamicAddedPropertyTests.cs b/TUnit.TestProject/FilterByDynamicAddedPropertyTests.cs index 5081483260..3557820109 100644 --- a/TUnit.TestProject/FilterByDynamicAddedPropertyTests.cs +++ b/TUnit.TestProject/FilterByDynamicAddedPropertyTests.cs @@ -16,5 +16,7 @@ public void OnTestDiscovery(DiscoveredTestContext discoveredTestContext) { discoveredTestContext.AddProperty("MyKey", "MyDynamicallyAddedValue"); } + + public int Order => 0; } } \ No newline at end of file diff --git a/TUnit.TestProject/GenericTests.cs b/TUnit.TestProject/GenericTests.cs index 81895d39ec..affcd37114 100644 --- a/TUnit.TestProject/GenericTests.cs +++ b/TUnit.TestProject/GenericTests.cs @@ -1,4 +1,6 @@ -using System.Numerics; +#if NET + +using System.Numerics; using TUnit.Assertions; using TUnit.Assertions.Extensions; @@ -81,4 +83,5 @@ public override IEnumerable GetEnumerableData() yield return 3.4; yield return 4.4; } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/TUnit.TestProject/Polyfills/FilePolyfill.cs b/TUnit.TestProject/Polyfills/FilePolyfill.cs new file mode 100644 index 0000000000..7f8fc0553a --- /dev/null +++ b/TUnit.TestProject/Polyfills/FilePolyfill.cs @@ -0,0 +1,38 @@ +using System.Text; + +namespace TUnit.TestProject.Polyfills; + +public class FilePolyfill +{ + public static async Task WriteAllTextAsync(string path, string content) + { + var directory = Path.GetDirectoryName(path); + if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + + using var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, 4096, useAsync: true); + + var encodedText = Encoding.UTF8.GetBytes(content); + + await fileStream.WriteAsync(encodedText, 0, encodedText.Length); + } + + public static async Task AppendAllLinesAsync(string path, IEnumerable lines) + { + var directory = Path.GetDirectoryName(path); + if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + + using var fileStream = new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.None, 4096, useAsync: true); + + foreach (var line in lines) + { + var encodedText = Encoding.UTF8.GetBytes(line + Environment.NewLine); + await fileStream.WriteAsync(encodedText, 0, encodedText.Length); + } + } +} \ No newline at end of file diff --git a/TUnit.TestProject/PropertySetterTests.cs b/TUnit.TestProject/PropertySetterTests.cs index c2ba77cf3b..f3ca610100 100644 --- a/TUnit.TestProject/PropertySetterTests.cs +++ b/TUnit.TestProject/PropertySetterTests.cs @@ -1,6 +1,7 @@ using TUnit.Assertions; using TUnit.Assertions.Extensions; using TUnit.Core.Interfaces; +using TUnit.TestProject.Polyfills; namespace TUnit.TestProject; @@ -95,7 +96,7 @@ public async ValueTask DisposeAsync() if (IsMatchingTestFilter()) { - await File.WriteAllTextAsync("Property_IAsyncDisposable.txt", "true"); + await FilePolyfill.WriteAllTextAsync("Property_IAsyncDisposable.txt", "true"); } } } @@ -118,7 +119,7 @@ public async ValueTask DisposeAsync() if (IsMatchingTestFilter()) { - await File.WriteAllTextAsync("StaticProperty_IAsyncDisposable.txt", "true"); + await FilePolyfill.WriteAllTextAsync("StaticProperty_IAsyncDisposable.txt", "true"); } } } @@ -130,13 +131,13 @@ private static async Task PrintMessage(string message) if (GlobalContext.Current.TestFilter is "/*/*/PropertySetterTests/*") { Console.WriteLine(message); - await File.AppendAllLinesAsync("PropertySetterTests_CapturedOutput.txt", [message]); + await FilePolyfill.AppendAllLinesAsync("PropertySetterTests_CapturedOutput.txt", [message]); } if (GlobalContext.Current.TestFilter is "/*/*/InheritedPropertySetterTests/*") { Console.WriteLine(message); - await File.AppendAllLinesAsync("InheritedPropertySetterTests_CapturedOutput.txt", [message]); + await FilePolyfill.AppendAllLinesAsync("InheritedPropertySetterTests_CapturedOutput.txt", [message]); } } diff --git a/TUnit.TestProject/ReturnTypeTests.cs b/TUnit.TestProject/ReturnTypeTests.cs index addefa6167..9b521fc44d 100644 --- a/TUnit.TestProject/ReturnTypeTests.cs +++ b/TUnit.TestProject/ReturnTypeTests.cs @@ -29,12 +29,12 @@ public Task Test4() [Test] public ValueTask Test5() { - return ValueTask.CompletedTask; + return default; } [Test] public ValueTask Test6() { - return ValueTask.FromResult(1); + return new ValueTask(1); } } \ No newline at end of file diff --git a/TUnit.TestProject/SetupTests.cs b/TUnit.TestProject/SetupTests.cs deleted file mode 100644 index 4db935ea63..0000000000 --- a/TUnit.TestProject/SetupTests.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System.Net; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting.Server; -using Microsoft.AspNetCore.Hosting.Server.Features; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.DependencyInjection; -using TUnit.Assertions; -using TUnit.Assertions.Extensions; - -namespace TUnit.TestProject; - -public class Base1 -{ - [Before(Class)] - public static async Task BeforeAll1() - { - await Task.CompletedTask; - } - - [Before(Test)] - public async Task BeforeEach1() - { - await Task.CompletedTask; - } -} - -public class Base2 : Base1 -{ - [Before(Class)] - public static async Task BeforeAll2() - { - await Task.CompletedTask; - } - - [Before(Test)] - public async Task BeforeEach2() - { - await Task.CompletedTask; - } -} - -public class Base3 : Base2 -{ - [Before(Class)] - public static async Task BeforeAll3() - { - await Task.CompletedTask; - } - - [Before(Test)] - public async Task BeforeEach3() - { - await Task.CompletedTask; - } -} - -public class SetupTests : Base3 -{ - private static WebApplication _app = null!; - private static string _serverAddress = null!; - private HttpResponseMessage? _response; - - private static int _beforeAllTestsInClassExecutionCount; - private static int _afterAllTestsInClassExecutionCount; - - [Before(Class)] - public static async Task SetUpLocalWebServer() - { - try - { - Interlocked.Increment(ref _beforeAllTestsInClassExecutionCount); - var builder = WebApplication.CreateBuilder(); - _app = builder.Build(); - - _app.MapGet("/ping", context => context.Response.WriteAsync($"Hello {context.Request.Query["testName"]}!")); - - await _app.StartAsync(); - _serverAddress = _app.Services.GetRequiredService() - .Features - .Get()! - .Addresses - .Last(); - } - catch (Exception e) - { - Console.WriteLine(e); - throw new Exception($$""" - Before(Class) Count: {{_beforeAllTestsInClassExecutionCount}} - After(Class) Count: {{_afterAllTestsInClassExecutionCount}} - """, e); - } - } - - [After(Class)] - public static async Task StopServer() - { - Interlocked.Increment(ref _afterAllTestsInClassExecutionCount); - - await _app.StopAsync(); - await _app.DisposeAsync(); - } - - [Before(Test)] - public async Task Setup() - { - _response = await new HttpClient().GetAsync($"{_serverAddress}/ping/?testName={TestContext.Current?.TestDetails.TestName}"); - } - - [After(Test)] - public void Dispose() - { - _response?.Dispose(); - } - - [Test] - public async Task TestServerResponse1() - { - await Assert.That(_response?.StatusCode).IsNotNull().And.IsEquatableOrEqualTo(HttpStatusCode.OK); - - await Assert.That(await _response!.Content.ReadAsStringAsync()) - .IsEqualTo("Hello TestServerResponse1!"); - } - - [Test] - public async Task TestServerResponse2() - { - await Assert.That(_response?.StatusCode).IsNotNull() - .And.IsEquatableOrEqualTo(HttpStatusCode.OK); - - await Assert.That(await _response!.Content.ReadAsStringAsync()) - .IsEqualTo("Hello TestServerResponse2!"); - } -} \ No newline at end of file diff --git a/TUnit.TestProject/SomethingElseAttribute.cs b/TUnit.TestProject/SomethingElseAttribute.cs index 53a6331371..81717bc28a 100644 --- a/TUnit.TestProject/SomethingElseAttribute.cs +++ b/TUnit.TestProject/SomethingElseAttribute.cs @@ -6,6 +6,12 @@ public class SomethingElseAttribute : Attribute, ITestStartEventReceiver { public ValueTask OnTestStart(BeforeTestContext beforeTestContext) { - return ValueTask.CompletedTask; + return default; } + + public void OnTestStartSynchronous(BeforeTestContext beforeTestContext) + { + } + + public int Order => 0; } \ No newline at end of file diff --git a/TUnit.TestProject/TUnit.TestProject.csproj b/TUnit.TestProject/TUnit.TestProject.csproj index 3bac244619..7370bf5049 100644 --- a/TUnit.TestProject/TUnit.TestProject.csproj +++ b/TUnit.TestProject/TUnit.TestProject.csproj @@ -1,25 +1,26 @@ + true false true Exe true true false - true + true - + false - - + + true true true - + true true true @@ -27,7 +28,7 @@ true IL2118 - + @@ -35,10 +36,9 @@ - + - @@ -46,8 +46,8 @@ - - + + @@ -57,4 +57,4 @@ PreserveNewest - \ No newline at end of file + diff --git a/TUnit.UnitTests/TUnit.UnitTests.csproj b/TUnit.UnitTests/TUnit.UnitTests.csproj index 8501be2464..b80d1df440 100644 --- a/TUnit.UnitTests/TUnit.UnitTests.csproj +++ b/TUnit.UnitTests/TUnit.UnitTests.csproj @@ -1,7 +1,8 @@ - net8.0 + false + true enable enable diff --git a/TUnit/TUnit.csproj b/TUnit/TUnit.csproj index 8f9931b7a4..767fcec01a 100644 --- a/TUnit/TUnit.csproj +++ b/TUnit/TUnit.csproj @@ -1,6 +1,7 @@  + true false false diff --git a/tools/speed-comparison/TUnitTimer/TUnitTimer/TUnitTimer.csproj b/tools/speed-comparison/TUnitTimer/TUnitTimer/TUnitTimer.csproj index 651b0ad991..b2b55663fb 100644 --- a/tools/speed-comparison/TUnitTimer/TUnitTimer/TUnitTimer.csproj +++ b/tools/speed-comparison/TUnitTimer/TUnitTimer/TUnitTimer.csproj @@ -18,5 +18,5 @@ true true - - \ No newline at end of file + + diff --git a/tools/tunit-nuget-tester/TUnit.NugetTester/TUnit.NugetTester.Library/TUnit.NugetTester.Library.csproj b/tools/tunit-nuget-tester/TUnit.NugetTester/TUnit.NugetTester.Library/TUnit.NugetTester.Library.csproj index 3ccb4c8d68..650af02674 100644 --- a/tools/tunit-nuget-tester/TUnit.NugetTester/TUnit.NugetTester.Library/TUnit.NugetTester.Library.csproj +++ b/tools/tunit-nuget-tester/TUnit.NugetTester/TUnit.NugetTester.Library/TUnit.NugetTester.Library.csproj @@ -1,7 +1,9 @@  - net8.0;net9.0 + net472; net8.0; net9.0 + latest + true enable enable @@ -10,6 +12,7 @@ $(TUnitVersion) + diff --git a/tools/tunit-nuget-tester/TUnit.NugetTester/TUnit.NugetTester/TUnit.NugetTester.csproj b/tools/tunit-nuget-tester/TUnit.NugetTester/TUnit.NugetTester/TUnit.NugetTester.csproj index 8e9618f143..8d7507d356 100644 --- a/tools/tunit-nuget-tester/TUnit.NugetTester/TUnit.NugetTester/TUnit.NugetTester.csproj +++ b/tools/tunit-nuget-tester/TUnit.NugetTester/TUnit.NugetTester/TUnit.NugetTester.csproj @@ -1,8 +1,10 @@  + net472; net8.0; net9.0 + latest Exe - net8.0;net9.0 + true enable enable @@ -10,7 +12,8 @@ $(TUnitVersion) - + +