diff --git a/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj b/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj
index 8811738112..da77d1b8fb 100644
--- a/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj
+++ b/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj
@@ -14,6 +14,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt
index 94f9d7a233..e869041ae4 100644
--- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt
+++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt
@@ -1085,3 +1085,171 @@ internal static class STAThreadTests_STA_WithExceptionHandling_ModuleInitializer
global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithExceptionHandling_TestSource_GUID());
}
}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class STAThreadTests_STA_WithThrowsNothingAssertion_TestSource_GUID : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource
+{
+ 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 = "STA_WithThrowsNothingAssertion",
+ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests),
+ TestMethodName = "STA_WithThrowsNothingAssertion",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.Core.Executors.STAThreadExecutorAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass),
+ new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows),
+ new global::TUnit.Core.RepeatAttribute(100),
+ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility")
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 194,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STA_WithThrowsNothingAssertion",
+ 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.STAThreadTests", () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STAThreadTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ foreach (var prop in classMetadata.Properties)
+ {
+ prop.ClassMetadata = classMetadata;
+ prop.ContainingTypeMetadata = classMetadata;
+ }
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(),
+ InvokeTypedTest = async (instance, args, cancellationToken) =>
+ {
+ await instance.STA_WithThrowsNothingAssertion();
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+}
+internal static class STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer_GUID
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithThrowsNothingAssertion_TestSource_GUID());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class STAThreadTests_STA_WithFuncAssertion_TestSource_GUID : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource
+{
+ 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 = "STA_WithFuncAssertion",
+ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests),
+ TestMethodName = "STA_WithFuncAssertion",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.Core.Executors.STAThreadExecutorAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass),
+ new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows),
+ new global::TUnit.Core.RepeatAttribute(100),
+ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility")
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 211,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STA_WithFuncAssertion",
+ 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.STAThreadTests", () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STAThreadTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ foreach (var prop in classMetadata.Properties)
+ {
+ prop.ClassMetadata = classMetadata;
+ prop.ContainingTypeMetadata = classMetadata;
+ }
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(),
+ InvokeTypedTest = async (instance, args, cancellationToken) =>
+ {
+ await instance.STA_WithFuncAssertion();
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+}
+internal static class STAThreadTests_STA_WithFuncAssertion_ModuleInitializer_GUID
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithFuncAssertion_TestSource_GUID());
+ }
+}
diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt
index 94f9d7a233..e869041ae4 100644
--- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt
+++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt
@@ -1085,3 +1085,171 @@ internal static class STAThreadTests_STA_WithExceptionHandling_ModuleInitializer
global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithExceptionHandling_TestSource_GUID());
}
}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class STAThreadTests_STA_WithThrowsNothingAssertion_TestSource_GUID : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource
+{
+ 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 = "STA_WithThrowsNothingAssertion",
+ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests),
+ TestMethodName = "STA_WithThrowsNothingAssertion",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.Core.Executors.STAThreadExecutorAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass),
+ new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows),
+ new global::TUnit.Core.RepeatAttribute(100),
+ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility")
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 194,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STA_WithThrowsNothingAssertion",
+ 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.STAThreadTests", () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STAThreadTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ foreach (var prop in classMetadata.Properties)
+ {
+ prop.ClassMetadata = classMetadata;
+ prop.ContainingTypeMetadata = classMetadata;
+ }
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(),
+ InvokeTypedTest = async (instance, args, cancellationToken) =>
+ {
+ await instance.STA_WithThrowsNothingAssertion();
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+}
+internal static class STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer_GUID
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithThrowsNothingAssertion_TestSource_GUID());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class STAThreadTests_STA_WithFuncAssertion_TestSource_GUID : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource
+{
+ 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 = "STA_WithFuncAssertion",
+ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests),
+ TestMethodName = "STA_WithFuncAssertion",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.Core.Executors.STAThreadExecutorAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass),
+ new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows),
+ new global::TUnit.Core.RepeatAttribute(100),
+ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility")
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 211,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STA_WithFuncAssertion",
+ 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.STAThreadTests", () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STAThreadTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ foreach (var prop in classMetadata.Properties)
+ {
+ prop.ClassMetadata = classMetadata;
+ prop.ContainingTypeMetadata = classMetadata;
+ }
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(),
+ InvokeTypedTest = async (instance, args, cancellationToken) =>
+ {
+ await instance.STA_WithFuncAssertion();
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+}
+internal static class STAThreadTests_STA_WithFuncAssertion_ModuleInitializer_GUID
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithFuncAssertion_TestSource_GUID());
+ }
+}
diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt
index 94f9d7a233..e869041ae4 100644
--- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt
+++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt
@@ -1085,3 +1085,171 @@ internal static class STAThreadTests_STA_WithExceptionHandling_ModuleInitializer
global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithExceptionHandling_TestSource_GUID());
}
}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class STAThreadTests_STA_WithThrowsNothingAssertion_TestSource_GUID : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource
+{
+ 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 = "STA_WithThrowsNothingAssertion",
+ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests),
+ TestMethodName = "STA_WithThrowsNothingAssertion",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.Core.Executors.STAThreadExecutorAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass),
+ new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows),
+ new global::TUnit.Core.RepeatAttribute(100),
+ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility")
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 194,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STA_WithThrowsNothingAssertion",
+ 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.STAThreadTests", () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STAThreadTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ foreach (var prop in classMetadata.Properties)
+ {
+ prop.ClassMetadata = classMetadata;
+ prop.ContainingTypeMetadata = classMetadata;
+ }
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(),
+ InvokeTypedTest = async (instance, args, cancellationToken) =>
+ {
+ await instance.STA_WithThrowsNothingAssertion();
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+}
+internal static class STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer_GUID
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithThrowsNothingAssertion_TestSource_GUID());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class STAThreadTests_STA_WithFuncAssertion_TestSource_GUID : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource
+{
+ 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 = "STA_WithFuncAssertion",
+ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests),
+ TestMethodName = "STA_WithFuncAssertion",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.Core.Executors.STAThreadExecutorAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass),
+ new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows),
+ new global::TUnit.Core.RepeatAttribute(100),
+ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility")
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 211,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STA_WithFuncAssertion",
+ 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.STAThreadTests", () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STAThreadTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ foreach (var prop in classMetadata.Properties)
+ {
+ prop.ClassMetadata = classMetadata;
+ prop.ContainingTypeMetadata = classMetadata;
+ }
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(),
+ InvokeTypedTest = async (instance, args, cancellationToken) =>
+ {
+ await instance.STA_WithFuncAssertion();
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+}
+internal static class STAThreadTests_STA_WithFuncAssertion_ModuleInitializer_GUID
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithFuncAssertion_TestSource_GUID());
+ }
+}
diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt
index c2cd3f5248..a31a6cc141 100644
--- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt
+++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt
@@ -1085,3 +1085,171 @@ internal static class STAThreadTests_STA_WithExceptionHandling_ModuleInitializer
global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithExceptionHandling_TestSource_GUID());
}
}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class STAThreadTests_STA_WithThrowsNothingAssertion_TestSource_GUID : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource
+{
+ 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 = "STA_WithThrowsNothingAssertion",
+ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests),
+ TestMethodName = "STA_WithThrowsNothingAssertion",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.Core.Executors.STAThreadExecutorAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass),
+ new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows),
+ new global::TUnit.Core.RepeatAttribute(100),
+ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility")
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 194,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STA_WithThrowsNothingAssertion",
+ 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.STAThreadTests", () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STAThreadTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ foreach (var prop in classMetadata.Properties)
+ {
+ prop.ClassMetadata = classMetadata;
+ prop.ContainingTypeMetadata = classMetadata;
+ }
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(),
+ InvokeTypedTest = async (instance, args, cancellationToken) =>
+ {
+ await instance.STA_WithThrowsNothingAssertion();
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+}
+internal static class STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer_GUID
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithThrowsNothingAssertion_TestSource_GUID());
+ }
+}
+
+
+// ===== FILE SEPARATOR =====
+
+//
+#pragma warning disable
+
+#nullable enable
+namespace TUnit.Generated;
+internal sealed class STAThreadTests_STA_WithFuncAssertion_TestSource_GUID : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource
+{
+ 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 = "STA_WithFuncAssertion",
+ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests),
+ TestMethodName = "STA_WithFuncAssertion",
+ Dependencies = global::System.Array.Empty(),
+ AttributeFactory = () =>
+ [
+ new global::TUnit.Core.TestAttribute(),
+ new global::TUnit.Core.Executors.STAThreadExecutorAttribute(),
+ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass),
+ new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows),
+ new global::TUnit.Core.RepeatAttribute(100),
+ new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility")
+ ],
+ DataSources = global::System.Array.Empty(),
+ ClassDataSources = global::System.Array.Empty(),
+ PropertyDataSources = global::System.Array.Empty(),
+ PropertyInjections = global::System.Array.Empty(),
+ InheritanceDepth = 0,
+ FilePath = @"",
+ LineNumber = 211,
+ MethodMetadata = new global::TUnit.Core.MethodMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STA_WithFuncAssertion",
+ 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.STAThreadTests", () =>
+ {
+ var classMetadata = new global::TUnit.Core.ClassMetadata
+ {
+ Type = typeof(global::TUnit.TestProject.STAThreadTests),
+ TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)),
+ Name = "STAThreadTests",
+ Namespace = "TUnit.TestProject",
+ Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }),
+ Parameters = global::System.Array.Empty(),
+ Properties = global::System.Array.Empty(),
+ Parent = null
+ };
+ foreach (var prop in classMetadata.Properties)
+ {
+ prop.ClassMetadata = classMetadata;
+ prop.ContainingTypeMetadata = classMetadata;
+ }
+ return classMetadata;
+ })
+ },
+ InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(),
+ InvokeTypedTest = async (instance, args, cancellationToken) =>
+ {
+ await instance.STA_WithFuncAssertion();
+ },
+ };
+ metadata.UseRuntimeDataGeneration(testSessionId);
+ yield return metadata;
+ yield break;
+ }
+}
+internal static class STAThreadTests_STA_WithFuncAssertion_ModuleInitializer_GUID
+{
+ [global::System.Runtime.CompilerServices.ModuleInitializer]
+ public static void Initialize()
+ {
+ global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new STAThreadTests_STA_WithFuncAssertion_TestSource_GUID());
+ }
+}
diff --git a/TUnit.Core/Attributes/Executors/CultureAttribute.cs b/TUnit.Core/Attributes/Executors/CultureAttribute.cs
index 30e3706921..be5f45c35e 100644
--- a/TUnit.Core/Attributes/Executors/CultureAttribute.cs
+++ b/TUnit.Core/Attributes/Executors/CultureAttribute.cs
@@ -12,10 +12,7 @@ public CultureAttribute(string cultureName) : this(CultureInfo.GetCultureInfo(cu
public int Order => 0;
-#if NET6_0_OR_GREATER
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Type comes from runtime objects that cannot be annotated")]
-#endif
- public ValueTask OnTestRegistered(TestRegisteredContext context)
+public ValueTask OnTestRegistered(TestRegisteredContext context)
{
context.SetTestExecutor(new CultureExecutor(cultureInfo));
return default(ValueTask);
diff --git a/TUnit.Core/Attributes/Executors/STAThreadExecutorAttribute.cs b/TUnit.Core/Attributes/Executors/STAThreadExecutorAttribute.cs
index 52b43a538e..a5a9f3a3ed 100644
--- a/TUnit.Core/Attributes/Executors/STAThreadExecutorAttribute.cs
+++ b/TUnit.Core/Attributes/Executors/STAThreadExecutorAttribute.cs
@@ -9,10 +9,7 @@ public class STAThreadExecutorAttribute : TUnitAttribute, ITestRegisteredEventRe
{
public int Order => 0;
-#if NET6_0_OR_GREATER
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Type comes from runtime objects that cannot be annotated")]
-#endif
- public ValueTask OnTestRegistered(TestRegisteredContext context)
+public ValueTask OnTestRegistered(TestRegisteredContext context)
{
var executor = new STAThreadExecutor();
context.SetTestExecutor(executor);
diff --git a/TUnit.Core/Attributes/Executors/TestExecutorAttribute.cs b/TUnit.Core/Attributes/Executors/TestExecutorAttribute.cs
index 9d32a2d863..368c79bce2 100644
--- a/TUnit.Core/Attributes/Executors/TestExecutorAttribute.cs
+++ b/TUnit.Core/Attributes/Executors/TestExecutorAttribute.cs
@@ -8,10 +8,7 @@ namespace TUnit.Core.Executors;
{
public int Order => 0;
-#if NET6_0_OR_GREATER
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Type comes from runtime objects that cannot be annotated")]
-#endif
- public ValueTask OnTestRegistered(TestRegisteredContext context)
+public ValueTask OnTestRegistered(TestRegisteredContext context)
{
context.SetTestExecutor(new T());
return default(ValueTask);
@@ -23,10 +20,7 @@ public sealed class TestExecutorAttribute([DynamicallyAccessedMembers(Dynamicall
{
public int Order => 0;
-#if NET6_0_OR_GREATER
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Type comes from runtime objects that cannot be annotated")]
-#endif
- public ValueTask OnTestRegistered(TestRegisteredContext context)
+public ValueTask OnTestRegistered(TestRegisteredContext context)
{
context.SetTestExecutor((ITestExecutor) Activator.CreateInstance(type)!);
return default(ValueTask);
diff --git a/TUnit.Core/Attributes/IScopedAttribute.cs b/TUnit.Core/Attributes/IScopedAttribute.cs
index 0e306e9d0b..4377f7f5c0 100644
--- a/TUnit.Core/Attributes/IScopedAttribute.cs
+++ b/TUnit.Core/Attributes/IScopedAttribute.cs
@@ -1,5 +1,6 @@
namespace TUnit.Core;
-public interface IScopedAttribute;
-
-public interface IScopedAttribute : IScopedAttribute where T : Attribute;
+public interface IScopedAttribute
+{
+ public Type ScopeType { get; }
+}
diff --git a/TUnit.Core/Attributes/ParallelLimiterAttribute.cs b/TUnit.Core/Attributes/ParallelLimiterAttribute.cs
index 1b5cc88b84..5a3ae08814 100644
--- a/TUnit.Core/Attributes/ParallelLimiterAttribute.cs
+++ b/TUnit.Core/Attributes/ParallelLimiterAttribute.cs
@@ -6,7 +6,7 @@ namespace TUnit.Core;
/// Limits the number of tests that can run in parallel for a test assembly, class, or method.
///
///
-/// The type that implements and defines the maximum number
+/// The type that implements and defines the maximum number
/// of tests that can execute concurrently.
///
///
@@ -15,7 +15,7 @@ namespace TUnit.Core;
/// class, or method, it limits how many tests from that scope can run simultaneously.
///
///
-/// The parallelism limit is defined by the property of the
+/// The parallelism limit is defined by the property of the
/// instance. This value is used to create a semaphore that
/// controls concurrent test execution.
///
@@ -31,14 +31,14 @@ namespace TUnit.Core;
///
/// // Apply to an assembly to limit all tests
/// [assembly: ParallelLimiter<DefaultParallelLimit>]
-///
+///
/// // Apply to a class to limit tests in that class
/// [ParallelLimiter<ParallelLimit3>]
/// public class MyTestClass
/// {
/// // Tests in this class will run with a maximum of 3 in parallel
/// }
-///
+///
/// // Apply to a specific test method
/// [Test]
/// [ParallelLimiter<ParallelLimit1>]
@@ -57,10 +57,7 @@ public sealed class ParallelLimiterAttribute : TUnitAttribute, I
public int Order => 0;
///
-#if NET6_0_OR_GREATER
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Type comes from runtime objects that cannot be annotated")]
-#endif
- public ValueTask OnTestRegistered(TestRegisteredContext context)
+public ValueTask OnTestRegistered(TestRegisteredContext context)
{
context.SetParallelLimiter(new TParallelLimit());
return default(ValueTask);
diff --git a/TUnit.Core/Attributes/TestData/ArgumentsAttribute.cs b/TUnit.Core/Attributes/TestData/ArgumentsAttribute.cs
index 0ff0cc87ff..8c3e58345d 100644
--- a/TUnit.Core/Attributes/TestData/ArgumentsAttribute.cs
+++ b/TUnit.Core/Attributes/TestData/ArgumentsAttribute.cs
@@ -27,10 +27,7 @@ public ArgumentsAttribute(params object?[]? values)
await Task.CompletedTask;
}
-#if NET6_0_OR_GREATER
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Type comes from runtime objects that cannot be annotated")]
-#endif
- public ValueTask OnTestRegistered(TestRegisteredContext context)
+public ValueTask OnTestRegistered(TestRegisteredContext context)
{
if(!string.IsNullOrEmpty(Skip))
{
@@ -55,10 +52,7 @@ public override async IAsyncEnumerable>> GetTypedDataRowsAsync(Data
await default(ValueTask);
}
-#if NET6_0_OR_GREATER
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Type comes from runtime objects that cannot be annotated")]
-#endif
- public ValueTask OnTestRegistered(TestRegisteredContext context)
+public ValueTask OnTestRegistered(TestRegisteredContext context)
{
if(!string.IsNullOrEmpty(Skip))
{
diff --git a/TUnit.Core/Attributes/TestMetadata/DisplayNameAttribute.cs b/TUnit.Core/Attributes/TestMetadata/DisplayNameAttribute.cs
index bc013e88a1..94570bcbb4 100644
--- a/TUnit.Core/Attributes/TestMetadata/DisplayNameAttribute.cs
+++ b/TUnit.Core/Attributes/TestMetadata/DisplayNameAttribute.cs
@@ -13,21 +13,21 @@ namespace TUnit.Core;
///
///
/// The display name can include parameter placeholders in the format of "$parameterName" which will be
-/// replaced with the actual parameter values during test execution. For test methods, method parameters
+/// replaced with the actual parameter values during test execution. For test methods, method parameters
/// will be used for substitution. For test classes, constructor parameters will be used for substitution. For example:
///
/// [Test]
/// [Arguments("John", 25)]
/// [DisplayName("User $name is $age years old")]
/// public void TestUser(string name, int age) { ... }
-///
+///
/// [Arguments("TestData")]
/// [DisplayName("Class with data: $data")]
/// public class MyTestClass(string data) { ... }
///
///
///
-/// When these tests run, the display names would appear as "User John is 25 years old" and
+/// When these tests run, the display names would appear as "User John is 25 years old" and
/// "Class with data: TestData" respectively.
///
///
@@ -36,7 +36,7 @@ namespace TUnit.Core;
/// For methods, method parameter names can be referenced. For classes, constructor parameter names can be referenced.
///
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
-public sealed class DisplayNameAttribute(string displayName) : DisplayNameFormatterAttribute, IScopedAttribute
+public sealed class DisplayNameAttribute(string displayName) : DisplayNameFormatterAttribute, IScopedAttribute
{
///
protected override string FormatDisplayName(DiscoveredTestContext context)
@@ -77,4 +77,6 @@ protected override string FormatDisplayName(DiscoveredTestContext context)
return mutableDisplayName;
}
+
+ public Type ScopeType => typeof(DisplayNameAttribute);
}
diff --git a/TUnit.Core/Attributes/TestMetadata/ExecutionPriorityAttribute.cs b/TUnit.Core/Attributes/TestMetadata/ExecutionPriorityAttribute.cs
index 0013b71cfb..cf6077d71a 100644
--- a/TUnit.Core/Attributes/TestMetadata/ExecutionPriorityAttribute.cs
+++ b/TUnit.Core/Attributes/TestMetadata/ExecutionPriorityAttribute.cs
@@ -4,7 +4,7 @@
namespace TUnit.Core;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
-public class ExecutionPriorityAttribute : SingleTUnitAttribute, ITestDiscoveryEventReceiver, IScopedAttribute
+public class ExecutionPriorityAttribute : SingleTUnitAttribute, ITestDiscoveryEventReceiver, IScopedAttribute
{
public Priority Priority { get; }
public int Order => 0;
@@ -19,4 +19,6 @@ public ValueTask OnTestDiscovered(DiscoveredTestContext context)
context.SetPriority(Priority);
return default(ValueTask);
}
+
+ public Type ScopeType => typeof(ExecutionPriorityAttribute);
}
diff --git a/TUnit.Core/Attributes/TestMetadata/NotInParallelAttribute.cs b/TUnit.Core/Attributes/TestMetadata/NotInParallelAttribute.cs
index 7475abe747..aed90bacbd 100644
--- a/TUnit.Core/Attributes/TestMetadata/NotInParallelAttribute.cs
+++ b/TUnit.Core/Attributes/TestMetadata/NotInParallelAttribute.cs
@@ -3,7 +3,7 @@
namespace TUnit.Core;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
-public class NotInParallelAttribute : SingleTUnitAttribute, ITestDiscoveryEventReceiver, IScopedAttribute
+public class NotInParallelAttribute : SingleTUnitAttribute, ITestDiscoveryEventReceiver, IScopedAttribute
{
public string[] ConstraintKeys { get; } = [];
@@ -39,4 +39,6 @@ public ValueTask OnTestDiscovered(DiscoveredTestContext context)
});
return default(ValueTask);
}
+
+ public Type ScopeType => typeof(NotInParallelAttribute);
}
diff --git a/TUnit.Core/Attributes/TestMetadata/RepeatAttribute.cs b/TUnit.Core/Attributes/TestMetadata/RepeatAttribute.cs
index 172ecd8740..783a4147df 100644
--- a/TUnit.Core/Attributes/TestMetadata/RepeatAttribute.cs
+++ b/TUnit.Core/Attributes/TestMetadata/RepeatAttribute.cs
@@ -2,7 +2,7 @@
// Don't think there's a way to enable inheritance on this because the source generator needs to access the constructor argument
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
-public sealed class RepeatAttribute : TUnitAttribute, IScopedAttribute
+public sealed class RepeatAttribute : TUnitAttribute, IScopedAttribute
{
public int Times { get; }
@@ -15,4 +15,6 @@ public RepeatAttribute(int times)
Times = times;
}
+
+ public Type ScopeType => typeof(RepeatAttribute);
}
diff --git a/TUnit.Core/Attributes/TestMetadata/RetryAttribute.cs b/TUnit.Core/Attributes/TestMetadata/RetryAttribute.cs
index 14eeecdfc7..921e421550 100644
--- a/TUnit.Core/Attributes/TestMetadata/RetryAttribute.cs
+++ b/TUnit.Core/Attributes/TestMetadata/RetryAttribute.cs
@@ -38,7 +38,7 @@ namespace TUnit.Core;
///
///
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
-public class RetryAttribute : TUnitAttribute, ITestDiscoveryEventReceiver, IScopedAttribute
+public class RetryAttribute : TUnitAttribute, ITestDiscoveryEventReceiver, IScopedAttribute
{
///
public int Order => 0;
@@ -97,4 +97,6 @@ public ValueTask OnTestDiscovered(DiscoveredTestContext context)
context.SetRetryLimit(Times, ShouldRetry);
return default(ValueTask);
}
+
+ public Type ScopeType => typeof(RetryAttribute);
}
diff --git a/TUnit.Core/Attributes/TestMetadata/SkipAttribute.cs b/TUnit.Core/Attributes/TestMetadata/SkipAttribute.cs
index f57dff0f0d..0b5b7e6feb 100644
--- a/TUnit.Core/Attributes/TestMetadata/SkipAttribute.cs
+++ b/TUnit.Core/Attributes/TestMetadata/SkipAttribute.cs
@@ -16,9 +16,6 @@ public SkipAttribute(string reason)
public int Order => int.MinValue;
///
-#if NET6_0_OR_GREATER
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Type comes from runtime objects that cannot be annotated")]
-#endif
public async ValueTask OnTestRegistered(TestRegisteredContext context)
{
if (await ShouldSkip(context))
diff --git a/TUnit.Core/Attributes/TestMetadata/TimeoutAttribute.cs b/TUnit.Core/Attributes/TestMetadata/TimeoutAttribute.cs
index 589ae05cce..2cde57aa09 100644
--- a/TUnit.Core/Attributes/TestMetadata/TimeoutAttribute.cs
+++ b/TUnit.Core/Attributes/TestMetadata/TimeoutAttribute.cs
@@ -32,7 +32,7 @@ namespace TUnit.Core;
///
///
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
-public class TimeoutAttribute(int timeoutInMilliseconds) : TUnitAttribute, ITestDiscoveryEventReceiver, IHookRegisteredEventReceiver, IScopedAttribute
+public class TimeoutAttribute(int timeoutInMilliseconds) : TUnitAttribute, ITestDiscoveryEventReceiver, IHookRegisteredEventReceiver, IScopedAttribute
{
///
public int Order => 0;
@@ -56,4 +56,6 @@ public ValueTask OnHookRegistered(HookRegisteredContext context)
context.Timeout = Timeout;
return default(ValueTask);
}
+
+ public Type ScopeType => typeof(TimeoutAttribute);
}
diff --git a/TUnit.Core/Executors/DedicatedThreadExecutor.cs b/TUnit.Core/Executors/DedicatedThreadExecutor.cs
index 9871446ada..fc1a7bb80e 100644
--- a/TUnit.Core/Executors/DedicatedThreadExecutor.cs
+++ b/TUnit.Core/Executors/DedicatedThreadExecutor.cs
@@ -87,7 +87,7 @@ private void ExecuteAsyncActionWithMessagePump(Func action, TaskCompl
var spinWait = new SpinWait();
var lastTimeCheck = DateTime.UtcNow;
const int TimeCheckIntervalMs = 100;
-
+
while (!task.IsCompleted)
{
var hadWork = dedicatedContext.ProcessPendingWork();
@@ -148,8 +148,8 @@ private static void HandleTaskCompletion(Task task, TaskCompletionSource