From 17bb06ba41ffc4d9948c713a3a09b7fd8d8829b4 Mon Sep 17 00:00:00 2001
From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com>
Date: Sat, 31 Jan 2026 21:13:48 +0000
Subject: [PATCH 01/11] fix: force synchronous library module initializer
completion
Fixes timing issue where hooks were collected before library module
initializers completed, resulting in 0 hooks found.
**Problem:**
Module initializers from different assemblies run asynchronously. When
test assembly's module initializer referenced library types via typeof(),
the library loaded but its module initializer was queued, not executed
synchronously. HookDelegateBuilder.InitializeAsync() then ran before
library hooks were registered to Sources.* collections.
**Solution:**
Use RuntimeHelpers.RunClassConstructor(type.TypeHandle) to force library
module initializers to complete synchronously. Static constructors can
only run AFTER module initializers, so this blocks until initialization
finishes. AOT-compatible (uses statically-known types).
**Changes:**
- InfrastructureGenerator: Replace typeof() with RunClassConstructor()
- Add logging for assembly initialization completion
- Update documentation explaining the fix
- Enhance Claude Code Review workflow to always comment and suggest
architectural improvements
**Snapshot Tests:**
Updated verified snapshots for fully qualified type names in generated code.
---
.github/workflows/claude-code-review.yml | 14 +-
...assDataSourceDrivenTests.Test.verified.txt | 112 +-
...ceDrivenTestsSharedKeyed.Test.verified.txt | 22 +-
...thConflictingNamespace.Net4_7.verified.txt | 294 +++
...thConflictingNamespace.Net4_7.verified.txt | 1221 ++++++++++++
...thConflictingNamespace.Net4_7.verified.txt | 1044 +++++++++++
...thConflictingNamespace.Net4_7.verified.txt | 1650 +++++++++++++++++
...thConflictingNamespace.Net4_7.verified.txt | 986 ++++++++++
...thConflictingNamespace.Net4_7.verified.txt | 142 ++
.../Tests1889.Test.Net4_7.verified.txt | 4 +-
.../CodeGenerators/InfrastructureGenerator.cs | 17 +-
11 files changed, 5434 insertions(+), 72 deletions(-)
create mode 100644 TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt
create mode 100644 TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt
create mode 100644 TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.Net4_7.verified.txt
create mode 100644 TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.Net4_7.verified.txt
create mode 100644 TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.Net4_7.verified.txt
create mode 100644 TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.Net4_7.verified.txt
diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml
index bb4626ae8f..08c3339bda 100644
--- a/.github/workflows/claude-code-review.yml
+++ b/.github/workflows/claude-code-review.yml
@@ -46,7 +46,19 @@ jobs:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
plugins: 'code-review@claude-code-plugins'
- prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number || inputs.pr_number }}'
+ prompt: |
+ /code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number || inputs.pr_number }}
+
+ Additional instructions:
+ - ALWAYS post a review comment, even if no issues are found. If the code is good, acknowledge it.
+ - When you find issues, ALWAYS suggest better approaches or architectural improvements, not just minor optimizations.
+ - Focus on:
+ * Design patterns that could be improved
+ * Alternative approaches that are more maintainable or scalable
+ * Architectural concerns or anti-patterns
+ * Better abstractions or simplifications
+ - Skip minor style/formatting issues unless they impact readability significantly.
+ - Always explain WHY the suggested approach is better, not just WHAT to change.
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt
index d4fdf1ef5e..564386e065 100644
--- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt
+++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt
@@ -1,4 +1,4 @@
-//
+//
#pragma warning disable
#nullable enable
@@ -262,7 +262,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
- new global::TUnit.Core.ClassDataSourceAttribute(),
+ new global::TUnit.Core.ClassDataSourceAttribute(),
},
ClassDataSources = global::System.Array.Empty(),
PropertyDataSources = global::System.Array.Empty(),
@@ -280,12 +280,12 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
Parameters = new global::TUnit.Core.ParameterMetadata[]
{
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class1",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_1_ClassDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass) }, null)!.GetParameters()[0]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_1_ClassDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0]
}
},
Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () =>
@@ -313,7 +313,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
{
case 1:
{
- return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_1_ClassDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])));
+ return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_1_ClassDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])));
}
default:
throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
@@ -382,7 +382,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
- new global::TUnit.Core.ClassDataSourceAttribute(),
+ new global::TUnit.Core.ClassDataSourceAttribute(),
},
ClassDataSources = global::System.Array.Empty(),
PropertyDataSources = global::System.Array.Empty(),
@@ -400,19 +400,19 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
Parameters = new global::TUnit.Core.ParameterMetadata[]
{
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class1",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[0]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class2",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[1]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[1]
}
},
Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () =>
@@ -440,7 +440,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
{
case 2:
{
- return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_2_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])));
+ return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_2_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])));
}
default:
throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}");
@@ -509,7 +509,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
- new global::TUnit.Core.ClassDataSourceAttribute(),
+ new global::TUnit.Core.ClassDataSourceAttribute(),
},
ClassDataSources = global::System.Array.Empty(),
PropertyDataSources = global::System.Array.Empty(),
@@ -527,26 +527,26 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
Parameters = new global::TUnit.Core.ParameterMetadata[]
{
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class1",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[0]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class2",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[1]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[1]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class3",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[2]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[2]
}
},
Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () =>
@@ -574,7 +574,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
{
case 3:
{
- return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_3_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])));
+ return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_3_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])));
}
default:
throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}");
@@ -643,7 +643,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
- new global::TUnit.Core.ClassDataSourceAttribute(),
+ new global::TUnit.Core.ClassDataSourceAttribute(),
},
ClassDataSources = global::System.Array.Empty(),
PropertyDataSources = global::System.Array.Empty(),
@@ -661,33 +661,33 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
Parameters = new global::TUnit.Core.ParameterMetadata[]
{
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class1",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[0]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class2",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[1]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[1]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class3",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[2]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[2]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class4",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[3]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[3]
}
},
Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () =>
@@ -715,7 +715,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
{
case 4:
{
- return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_4_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3])));
+ return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_4_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3])));
}
default:
throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}");
@@ -784,7 +784,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
- new global::TUnit.Core.ClassDataSourceAttribute(),
+ new global::TUnit.Core.ClassDataSourceAttribute(),
},
ClassDataSources = global::System.Array.Empty(),
PropertyDataSources = global::System.Array.Empty(),
@@ -802,40 +802,40 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
Parameters = new global::TUnit.Core.ParameterMetadata[]
{
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class1",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[0]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class2",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[1]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[1]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class3",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[2]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[2]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class4",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[3]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[3]
},
- new global::TUnit.Core.ParameterMetadata(typeof(InitializableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass))
{
Name = "class5",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(InitializableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass), typeof(InitializableClass) }, null)!.GetParameters()[4]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[4]
}
},
Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () =>
@@ -863,7 +863,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized
{
case 5:
{
- return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_5_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4])));
+ return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_5_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4])));
}
default:
throw new global::System.ArgumentException($"Expected exactly 5 arguments, but got {args.Length}");
diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt
index 4a6184deae..af49d2c290 100644
--- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt
+++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt
@@ -1,4 +1,4 @@
-//
+//
#pragma warning disable
#nullable enable
@@ -20,7 +20,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
- new global::TUnit.Core.ClassDataSourceAttribute()
+ new global::TUnit.Core.ClassDataSourceAttribute()
{Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",},
},
ClassDataSources = global::System.Array.Empty(),
@@ -39,12 +39,12 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da
ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
Parameters = new global::TUnit.Core.ParameterMetadata[]
{
- new global::TUnit.Core.ParameterMetadata(typeof(SomeAsyncDisposableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass))
{
Name = "value",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(SomeAsyncDisposableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(SomeAsyncDisposableClass) }, null)!.GetParameters()[0]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0]
}
},
Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", static () =>
@@ -72,7 +72,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da
{
case 1:
{
- instance.DataSource_Class(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ instance.DataSource_Class(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
return default(global::System.Threading.Tasks.ValueTask);
}
default:
@@ -142,7 +142,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
- new global::TUnit.Core.ClassDataSourceAttribute()
+ new global::TUnit.Core.ClassDataSourceAttribute()
{Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",},
},
ClassDataSources = global::System.Array.Empty(),
@@ -161,12 +161,12 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da
ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
Parameters = new global::TUnit.Core.ParameterMetadata[]
{
- new global::TUnit.Core.ParameterMetadata(typeof(SomeAsyncDisposableClass))
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass))
{
Name = "value",
- TypeInfo = new global::TUnit.Core.ConcreteType(typeof(SomeAsyncDisposableClass)),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)),
IsNullable = false,
- ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(SomeAsyncDisposableClass) }, null)!.GetParameters()[0]
+ ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0]
}
},
Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", static () =>
@@ -194,7 +194,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da
{
case 1:
{
- instance.DataSource_Class_Generic(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ instance.DataSource_Class_Generic(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
return default(global::System.Threading.Tasks.ValueTask);
}
default:
diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt
new file mode 100644
index 0000000000..3d1d68ebf1
--- /dev/null
+++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt
@@ -0,0 +1,294 @@
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "SynchronousTest",
+ TestClassType = typeof(global::TUnit.TestProject.BasicTests),
+ TestMethodName = "SynchronousTest",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute()
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 5,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BasicTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)),
+ Name = "SynchronousTest",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = global::System.Array.Empty(),
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BasicTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)),
+ Name = "BasicTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ instance.SynchronousTest();
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.BasicTests.SynchronousTest",
+ ClassName = "BasicTests",
+ MethodName = "SynchronousTest",
+ FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest",
+ FilePath = @"",
+ LineNumber = 5,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = false,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "AsynchronousTest",
+ TestClassType = typeof(global::TUnit.TestProject.BasicTests),
+ TestMethodName = "AsynchronousTest",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute()
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 11,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BasicTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)),
+ Name = "AsynchronousTest",
+ GenericTypeCount = 0,
+ ReturnType = typeof(global::System.Threading.Tasks.Task),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
+ Parameters = global::System.Array.Empty(),
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BasicTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)),
+ Name = "BasicTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest());
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.BasicTests.AsynchronousTest",
+ ClassName = "BasicTests",
+ MethodName = "AsynchronousTest",
+ FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest",
+ FilePath = @"",
+ LineNumber = 11,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = false,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "ValueTaskAsynchronousTest",
+ TestClassType = typeof(global::TUnit.TestProject.BasicTests),
+ TestMethodName = "ValueTaskAsynchronousTest",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute()
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 17,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BasicTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)),
+ Name = "ValueTaskAsynchronousTest",
+ GenericTypeCount = 0,
+ ReturnType = typeof(global::System.Threading.Tasks.ValueTask),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)),
+ Parameters = global::System.Array.Empty(),
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BasicTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)),
+ Name = "BasicTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ return instance.ValueTaskAsynchronousTest();
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest",
+ ClassName = "BasicTests",
+ MethodName = "ValueTaskAsynchronousTest",
+ FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest",
+ FilePath = @"",
+ LineNumber = 17,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = false,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource());
+ }
+}
diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt
new file mode 100644
index 0000000000..a541fe4504
--- /dev/null
+++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt
@@ -0,0 +1,1221 @@
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "DataSource_Method",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "DataSource_Method",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute(1),
+ new global::TUnit.Core.ArgumentsAttribute(2),
+ new global::TUnit.Core.ArgumentsAttribute(3),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 8,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataSource_Method",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(int))
+ {
+ Name = "value",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)),
+ IsNullable = false,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 1:
+ {
+ instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method",
+ ClassName = "DataDrivenTests",
+ MethodName = "DataSource_Method",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method",
+ FilePath = @"",
+ LineNumber = 8,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "DataSource_Method",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "DataSource_Method",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute(1, "String"),
+ new global::TUnit.Core.ArgumentsAttribute(2, "String2"),
+ new global::TUnit.Core.ArgumentsAttribute(3, "String3"),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 17,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataSource_Method",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(int))
+ {
+ Name = "value",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)),
+ IsNullable = false,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[0]
+ },
+ new global::TUnit.Core.ParameterMetadata(typeof(string))
+ {
+ Name = "value2",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)),
+ IsNullable = false,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 2:
+ {
+ instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method",
+ ClassName = "DataDrivenTests",
+ MethodName = "DataSource_Method",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method",
+ FilePath = @"",
+ LineNumber = 17,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "EnumValue",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "EnumValue",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One),
+ new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two),
+ new global::TUnit.Core.ArgumentsAttribute(-1),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 26,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "EnumValue",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.TestEnum))
+ {
+ Name = "testEnum",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)),
+ IsNullable = false,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 1:
+ {
+ instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.EnumValue",
+ ClassName = "DataDrivenTests",
+ MethodName = "EnumValue",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue",
+ FilePath = @"",
+ LineNumber = 26,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "NullValue",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "NullValue",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute(null),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 35,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "NullValue",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(string))
+ {
+ Name = "value",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)),
+ IsNullable = true,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 1:
+ {
+ instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.NullValue",
+ ClassName = "DataDrivenTests",
+ MethodName = "NullValue",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue",
+ FilePath = @"",
+ LineNumber = 35,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "EmptyString",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "EmptyString",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute(""),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 42,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "EmptyString",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(string))
+ {
+ Name = "value",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)),
+ IsNullable = true,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 1:
+ {
+ instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.EmptyString",
+ ClassName = "DataDrivenTests",
+ MethodName = "EmptyString",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString",
+ FilePath = @"",
+ LineNumber = 42,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "NonEmptyString",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "NonEmptyString",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute("Foo bar!"),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 49,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "NonEmptyString",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(string))
+ {
+ Name = "value",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)),
+ IsNullable = true,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 1:
+ {
+ instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString",
+ ClassName = "DataDrivenTests",
+ MethodName = "NonEmptyString",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString",
+ FilePath = @"",
+ LineNumber = 49,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "BooleanString",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "BooleanString",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute(null),
+ new global::TUnit.Core.ArgumentsAttribute(false),
+ new global::TUnit.Core.ArgumentsAttribute(true),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 56,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "BooleanString",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(bool?))
+ {
+ Name = "value",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)),
+ IsNullable = true,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 1:
+ {
+ instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.BooleanString",
+ ClassName = "DataDrivenTests",
+ MethodName = "BooleanString",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString",
+ FilePath = @"",
+ LineNumber = 56,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "Type",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "Type",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute(typeof(object)),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 65,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "Type",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(global::System.Type))
+ {
+ Name = "value",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Type)),
+ IsNullable = false,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 1:
+ {
+ instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.Type",
+ ClassName = "DataDrivenTests",
+ MethodName = "Type",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type",
+ FilePath = @"",
+ LineNumber = 65,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "IntegerArray",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "IntegerArray",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 72,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "IntegerArray",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(int[]))
+ {
+ Name = "values",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int[])),
+ IsNullable = false,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 1:
+ {
+ instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray",
+ ClassName = "DataDrivenTests",
+ MethodName = "IntegerArray",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray",
+ FilePath = @"",
+ LineNumber = 72,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource
+{
+ public async global::System.Collections.Generic.IAsyncEnumerable GetTestsAsync(string testSessionId, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var metadata = new global::TUnit.Core.TestMetadata
+ {
+ TestName = "IntMaxValue",
+ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TestMethodName = "IntMaxValue",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = static () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass)
+ ],
+ DataSources = new global::TUnit.Core.IDataSourceAttribute[]
+ {
+ new global::TUnit.Core.ArgumentsAttribute(2147483647),
+ },
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 79,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "IntMaxValue",
+ GenericTypeCount = 0,
+ ReturnType = typeof(void),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)),
+ Parameters = new global::TUnit.Core.ParameterMetadata[]
+ {
+ new global::TUnit.Core.ParameterMetadata(typeof(int))
+ {
+ Name = "value",
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)),
+ IsNullable = false,
+ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0]
+ }
+ },
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.DataDrivenTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)),
+ Name = "DataDrivenTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(),
+ InvokeTypedTest = static (instance, args, cancellationToken) =>
+ {
+ try
+ {
+ switch (args.Length)
+ {
+ case 1:
+ {
+ instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]));
+ return default(global::System.Threading.Tasks.ValueTask);
+ }
+ default:
+ throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}");
+ }
+ }
+ catch (global::System.Exception ex)
+ {
+ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));
+ }
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+ public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()
+ {
+ yield return new global::TUnit.Core.TestDescriptor
+ {
+ TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue",
+ ClassName = "DataDrivenTests",
+ MethodName = "IntMaxValue",
+ FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue",
+ FilePath = @"",
+ LineNumber = 79,
+ Categories = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ HasDataSource = true,
+ RepeatCount = 0,
+ DependsOn = global::System.Array.Empty(),
+ Materializer = GetTestsAsync
+ };
+ }
+}
+internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource());
+ }
+}
diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.Net4_7.verified.txt
new file mode 100644
index 0000000000..5be7810cdf
--- /dev/null
+++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.Net4_7.verified.txt
@@ -0,0 +1,1044 @@
+//
+#pragma warning disable
+
+#nullable enable
+#pragma warning disable CS9113 // Parameter is unread.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Threading.Tasks;
+using global::TUnit.Core;
+using global::TUnit.Core.Hooks;
+using global::TUnit.Core.Interfaces.SourceGenerator;
+using global::TUnit.Core.Models;
+using HookType = global::TUnit.Core.HookType;
+namespace TUnit.Generated.Hooks.TUnit_TestProject_BeforeTests_Base1_BeforeAll1_Before_Class;
+internal static class TUnit_TestProject_BeforeTests_Base1_BeforeAll1_Before_ClassInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.Sources.BeforeClassHooks.GetOrAdd(typeof(global::TUnit.TestProject.BeforeTests.Base1), static _ => new global::System.Collections.Concurrent.ConcurrentBag());
+ global::TUnit.Core.Sources.BeforeClassHooks[typeof(global::TUnit.TestProject.BeforeTests.Base1)].Add(
+ new BeforeClassHookMethod
+ {
+ MethodInfo = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base1),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)),
+ Name = "BeforeAll1",
+ GenericTypeCount = 0,
+ ReturnType = typeof(global::System.Threading.Tasks.Task),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
+ Parameters = global::System.Array.Empty(),
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base1),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)),
+ Name = "Base1",
+ Namespace = "TUnit.TestProject.BeforeTests",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ HookExecutor = DefaultExecutor.Instance,
+ Order = 0,
+ RegistrationIndex = global::TUnit.Core.HookRegistrationIndices.GetNextBeforeClassHookIndex(),
+ Body = global_TUnit_TestProject_BeforeTests_Base1_BeforeAll1_0Params_Body,
+ FilePath = @"",
+ LineNumber = 5
+ }
+ );
+ }
+ private static async ValueTask global_TUnit_TestProject_BeforeTests_Base1_BeforeAll1_0Params_Body(ClassHookContext context, CancellationToken cancellationToken)
+ {
+ await AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base1.BeforeAll1());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+#pragma warning disable CS9113 // Parameter is unread.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Threading.Tasks;
+using global::TUnit.Core;
+using global::TUnit.Core.Hooks;
+using global::TUnit.Core.Interfaces.SourceGenerator;
+using global::TUnit.Core.Models;
+using HookType = global::TUnit.Core.HookType;
+namespace TUnit.Generated.Hooks.TUnit_TestProject_BeforeTests_Base1_BeforeEach1_Before_Test;
+internal static class TUnit_TestProject_BeforeTests_Base1_BeforeEach1_Before_TestInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.Sources.BeforeTestHooks.GetOrAdd(typeof(global::TUnit.TestProject.BeforeTests.Base1), static _ => new global::System.Collections.Concurrent.ConcurrentBag());
+ global::TUnit.Core.Sources.BeforeTestHooks[typeof(global::TUnit.TestProject.BeforeTests.Base1)].Add(
+ new InstanceHookMethod
+ {
+ InitClassType = typeof(global::TUnit.TestProject.BeforeTests.Base1),
+ MethodInfo = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base1),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)),
+ Name = "BeforeEach1",
+ GenericTypeCount = 0,
+ ReturnType = typeof(global::System.Threading.Tasks.Task),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
+ Parameters = global::System.Array.Empty(),
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base1),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)),
+ Name = "Base1",
+ Namespace = "TUnit.TestProject.BeforeTests",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ HookExecutor = DefaultExecutor.Instance,
+ Order = 0,
+ RegistrationIndex = global::TUnit.Core.HookRegistrationIndices.GetNextBeforeTestHookIndex(),
+ Body = global_TUnit_TestProject_BeforeTests_Base1_BeforeEach1_0Params_Body
+ }
+ );
+ }
+ private static async ValueTask global_TUnit_TestProject_BeforeTests_Base1_BeforeEach1_0Params_Body(object instance, TestContext context, CancellationToken cancellationToken)
+ {
+ var typedInstance = (global::TUnit.TestProject.BeforeTests.Base1)instance;
+ await AsyncConvert.Convert(() => typedInstance.BeforeEach1());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+#pragma warning disable CS9113 // Parameter is unread.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Threading.Tasks;
+using global::TUnit.Core;
+using global::TUnit.Core.Hooks;
+using global::TUnit.Core.Interfaces.SourceGenerator;
+using global::TUnit.Core.Models;
+using HookType = global::TUnit.Core.HookType;
+namespace TUnit.Generated.Hooks.TUnit_TestProject_BeforeTests_Base2_BeforeAll2_Before_Class;
+internal static class TUnit_TestProject_BeforeTests_Base2_BeforeAll2_Before_ClassInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.Sources.BeforeClassHooks.GetOrAdd(typeof(global::TUnit.TestProject.BeforeTests.Base2), static _ => new global::System.Collections.Concurrent.ConcurrentBag());
+ global::TUnit.Core.Sources.BeforeClassHooks[typeof(global::TUnit.TestProject.BeforeTests.Base2)].Add(
+ new BeforeClassHookMethod
+ {
+ MethodInfo = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base2),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)),
+ Name = "BeforeAll2",
+ GenericTypeCount = 0,
+ ReturnType = typeof(global::System.Threading.Tasks.Task),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
+ Parameters = global::System.Array.Empty(),
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base2),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)),
+ Name = "Base2",
+ Namespace = "TUnit.TestProject.BeforeTests",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ HookExecutor = DefaultExecutor.Instance,
+ Order = 0,
+ RegistrationIndex = global::TUnit.Core.HookRegistrationIndices.GetNextBeforeClassHookIndex(),
+ Body = global_TUnit_TestProject_BeforeTests_Base2_BeforeAll2_0Params_Body,
+ FilePath = @"",
+ LineNumber = 20
+ }
+ );
+ }
+ private static async ValueTask global_TUnit_TestProject_BeforeTests_Base2_BeforeAll2_0Params_Body(ClassHookContext context, CancellationToken cancellationToken)
+ {
+ await AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base2.BeforeAll2());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+#pragma warning disable CS9113 // Parameter is unread.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Threading.Tasks;
+using global::TUnit.Core;
+using global::TUnit.Core.Hooks;
+using global::TUnit.Core.Interfaces.SourceGenerator;
+using global::TUnit.Core.Models;
+using HookType = global::TUnit.Core.HookType;
+namespace TUnit.Generated.Hooks.TUnit_TestProject_BeforeTests_Base2_BeforeEach2_Before_Test;
+internal static class TUnit_TestProject_BeforeTests_Base2_BeforeEach2_Before_TestInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.Sources.BeforeTestHooks.GetOrAdd(typeof(global::TUnit.TestProject.BeforeTests.Base2), static _ => new global::System.Collections.Concurrent.ConcurrentBag());
+ global::TUnit.Core.Sources.BeforeTestHooks[typeof(global::TUnit.TestProject.BeforeTests.Base2)].Add(
+ new InstanceHookMethod
+ {
+ InitClassType = typeof(global::TUnit.TestProject.BeforeTests.Base2),
+ MethodInfo = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base2),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)),
+ Name = "BeforeEach2",
+ GenericTypeCount = 0,
+ ReturnType = typeof(global::System.Threading.Tasks.Task),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
+ Parameters = global::System.Array.Empty(),
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base2),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)),
+ Name = "Base2",
+ Namespace = "TUnit.TestProject.BeforeTests",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ HookExecutor = DefaultExecutor.Instance,
+ Order = 0,
+ RegistrationIndex = global::TUnit.Core.HookRegistrationIndices.GetNextBeforeTestHookIndex(),
+ Body = global_TUnit_TestProject_BeforeTests_Base2_BeforeEach2_0Params_Body
+ }
+ );
+ }
+ private static async ValueTask global_TUnit_TestProject_BeforeTests_Base2_BeforeEach2_0Params_Body(object instance, TestContext context, CancellationToken cancellationToken)
+ {
+ var typedInstance = (global::TUnit.TestProject.BeforeTests.Base2)instance;
+ await AsyncConvert.Convert(() => typedInstance.BeforeEach2());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+#pragma warning disable CS9113 // Parameter is unread.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Threading.Tasks;
+using global::TUnit.Core;
+using global::TUnit.Core.Hooks;
+using global::TUnit.Core.Interfaces.SourceGenerator;
+using global::TUnit.Core.Models;
+using HookType = global::TUnit.Core.HookType;
+namespace TUnit.Generated.Hooks.TUnit_TestProject_BeforeTests_Base3_BeforeAll3_Before_Class;
+internal static class TUnit_TestProject_BeforeTests_Base3_BeforeAll3_Before_ClassInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.Sources.BeforeClassHooks.GetOrAdd(typeof(global::TUnit.TestProject.BeforeTests.Base3), static _ => new global::System.Collections.Concurrent.ConcurrentBag());
+ global::TUnit.Core.Sources.BeforeClassHooks[typeof(global::TUnit.TestProject.BeforeTests.Base3)].Add(
+ new BeforeClassHookMethod
+ {
+ MethodInfo = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base3),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)),
+ Name = "BeforeAll3",
+ GenericTypeCount = 0,
+ ReturnType = typeof(global::System.Threading.Tasks.Task),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
+ Parameters = global::System.Array.Empty(),
+ Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", static () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base3),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)),
+ Name = "Base3",
+ Namespace = "TUnit.TestProject.BeforeTests",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ return classMetadata;
+ })
+ },
+ HookExecutor = DefaultExecutor.Instance,
+ Order = 0,
+ RegistrationIndex = global::TUnit.Core.HookRegistrationIndices.GetNextBeforeClassHookIndex(),
+ Body = global_TUnit_TestProject_BeforeTests_Base3_BeforeAll3_0Params_Body,
+ FilePath = @"",
+ LineNumber = 35
+ }
+ );
+ }
+ private static async ValueTask global_TUnit_TestProject_BeforeTests_Base3_BeforeAll3_0Params_Body(ClassHookContext context, CancellationToken cancellationToken)
+ {
+ await AsyncConvert.Convert(() => global::TUnit.TestProject.BeforeTests.Base3.BeforeAll3());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+#pragma warning disable CS9113 // Parameter is unread.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Threading.Tasks;
+using global::TUnit.Core;
+using global::TUnit.Core.Hooks;
+using global::TUnit.Core.Interfaces.SourceGenerator;
+using global::TUnit.Core.Models;
+using HookType = global::TUnit.Core.HookType;
+namespace TUnit.Generated.Hooks.TUnit_TestProject_BeforeTests_Base3_BeforeEach3_Before_Test;
+internal static class TUnit_TestProject_BeforeTests_Base3_BeforeEach3_Before_TestInitializer
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.Sources.BeforeTestHooks.GetOrAdd(typeof(global::TUnit.TestProject.BeforeTests.Base3), static _ => new global::System.Collections.Concurrent.ConcurrentBag());
+ global::TUnit.Core.Sources.BeforeTestHooks[typeof(global::TUnit.TestProject.BeforeTests.Base3)].Add(
+ new InstanceHookMethod
+ {
+ InitClassType = typeof(global::TUnit.TestProject.BeforeTests.Base3),
+ MethodInfo = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.BeforeTests.Base3),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)),
+ Name = "BeforeEach3",
+ GenericTypeCount = 0,
+ ReturnType = typeof(global::System.Threading.Tasks.Task),
+ ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)),
+ Parameters = global::System.Array.Empty