diff --git a/Directory.Packages.props b/Directory.Packages.props
index e511c7ef75..4f05a2359c 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -52,7 +52,7 @@
-
+
@@ -72,7 +72,7 @@
-
+
@@ -100,14 +100,14 @@
-
+
-
-
-
-
-
+
+
+
+
+
diff --git a/TUnit.Analyzers.Tests/XUnitMigrationAnalyzerTests.cs b/TUnit.Analyzers.Tests/XUnitMigrationAnalyzerTests.cs
index 5b86515664..e8e9cafa7f 100644
--- a/TUnit.Analyzers.Tests/XUnitMigrationAnalyzerTests.cs
+++ b/TUnit.Analyzers.Tests/XUnitMigrationAnalyzerTests.cs
@@ -1487,6 +1487,86 @@ public async Task MyTest()
);
}
+ [Test]
+ public async Task Assert_Throws_Sync_Delegate_Stays_Sync()
+ {
+ await CodeFixer
+ .VerifyCodeFixAsync(
+ """
+ {|#0:using System;
+ using Xunit;
+
+ public class MyClass
+ {
+ [Fact]
+ public void MyTest()
+ {
+ Assert.Throws(() => ThrowException());
+ }
+
+ private void ThrowException() => throw new ArgumentException();
+ }|}
+ """,
+ Verifier.Diagnostic(Rules.XunitMigration).WithLocation(0),
+ """
+ using System;
+
+ public class MyClass
+ {
+ [Test]
+ public void MyTest()
+ {
+ Assert.Throws(() => ThrowException());
+ }
+
+ private void ThrowException() => throw new ArgumentException();
+ }
+ """,
+ ConfigureXUnitTest
+ );
+ }
+
+ [Test]
+ public async Task Assert_ThrowsAsync_Async_Delegate_Stays_Async()
+ {
+ await CodeFixer
+ .VerifyCodeFixAsync(
+ """
+ {|#0:using System;
+ using System.Threading.Tasks;
+ using Xunit;
+
+ public class MyClass
+ {
+ [Fact]
+ public async Task MyTest()
+ {
+ await Assert.ThrowsAsync(() => ThrowExceptionAsync());
+ }
+
+ private Task ThrowExceptionAsync() => Task.FromException(new ArgumentException());
+ }|}
+ """,
+ Verifier.Diagnostic(Rules.XunitMigration).WithLocation(0),
+ """
+ using System;
+ using System.Threading.Tasks;
+
+ public class MyClass
+ {
+ [Test]
+ public async Task MyTest()
+ {
+ await Assert.ThrowsAsync(() => ThrowExceptionAsync());
+ }
+
+ private Task ThrowExceptionAsync() => Task.FromException(new ArgumentException());
+ }
+ """,
+ ConfigureXUnitTest
+ );
+ }
+
[Test]
public async Task Assert_Throws_With_Message_Contains_Can_Be_Converted()
{
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet10_0.verified.txt
index 712c765f98..ae6546b9cc 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet10_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet10_0.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet8_0.verified.txt
index 712c765f98..ae6546b9cc 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet8_0.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet9_0.verified.txt
index 712c765f98..ae6546b9cc 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_dictionary_specialization_emits_matching_Should_overload.DotNet9_0.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet10_0.verified.txt
index 25318db419..74c3527b71 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet10_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet10_0.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet8_0.verified.txt
index 25318db419..74c3527b71 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet8_0.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet9_0.verified.txt
index 25318db419..74c3527b71 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Assert_That_set_specialization_emits_matching_Should_overload.DotNet9_0.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet10_0.verified.txt
index b3f7d6a0d2..dbcdc1aea4 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet10_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet10_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet8_0.verified.txt
index b3f7d6a0d2..dbcdc1aea4 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet8_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet9_0.verified.txt
index b3f7d6a0d2..dbcdc1aea4 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.CallerArgumentExpression_attribute_is_propagated.DotNet9_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet10_0.verified.txt
index e9e994dc97..e2246d66fe 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet10_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet10_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet8_0.verified.txt
index e9e994dc97..e2246d66fe 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet8_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet9_0.verified.txt
index e9e994dc97..e2246d66fe 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.GenericAssertionExtension_emits_method_generic_param.DotNet9_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet10_0.verified.txt
index 4ed689d27c..c1d0e847aa 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet10_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet10_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet8_0.verified.txt
index 4ed689d27c..c1d0e847aa 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet8_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet9_0.verified.txt
index 4ed689d27c..c1d0e847aa 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.IsNot_prefix_conjugates_to_NotBe.DotNet9_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet10_0.verified.txt
index d77d861405..4dcbcc16a9 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet10_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet10_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet8_0.verified.txt
index d77d861405..4dcbcc16a9 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet8_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet9_0.verified.txt
index d77d861405..4dcbcc16a9 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Obsolete_attribute_is_forwarded.DotNet9_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Overload_with_trailing_optional_constructor_parameter_is_emitted.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Overload_with_trailing_optional_constructor_parameter_is_emitted.DotNet10_0.verified.txt
new file mode 100644
index 0000000000..52ab2f6509
--- /dev/null
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Overload_with_trailing_optional_constructor_parameter_is_emitted.DotNet10_0.verified.txt
@@ -0,0 +1,47 @@
+//
+#pragma warning disable
+#nullable enable
+
+using System;
+using System.Runtime.CompilerServices;
+using TUnit.Assertions.Core;
+using TUnit.Assertions.Should.Core;
+
+namespace TUnit.Assertions.Should.Extensions;
+
+public static partial class ShouldExceptionExtensions
+{
+
+ public static global::TUnit.Assertions.Should.Core.ShouldAssertion WithMessage(this global::TUnit.Assertions.Should.Core.IShouldSource source, string expectedMessage, [global::System.Runtime.CompilerServices.CallerArgumentExpression("expectedMessage")] string? expression = null)
+ where TException : System.Exception
+ {
+ var innerContext = source.Context;
+ innerContext.ExpressionBuilder.Append(".WithMessage(");
+ innerContext.ExpressionBuilder.Append(expression);
+ innerContext.ExpressionBuilder.Append(")");
+ var inner = new global::MyNamespace.ExceptionMessageEqualsAssertion(innerContext, expectedMessage);
+ var __tunit_should_because = source.ConsumeBecauseMessage();
+ if (__tunit_should_because is not null)
+ {
+ inner.Because(__tunit_should_because);
+ }
+ return new global::TUnit.Assertions.Should.Core.ShouldAssertion(innerContext, inner);
+ }
+
+ public static global::TUnit.Assertions.Should.Core.ShouldAssertion WithMessage(this global::TUnit.Assertions.Should.Core.IShouldSource source, string expectedMessage, System.StringComparison comparison, [global::System.Runtime.CompilerServices.CallerArgumentExpression("expectedMessage")] string? expression = null)
+ where TException : System.Exception
+ {
+ var innerContext = source.Context;
+ innerContext.ExpressionBuilder.Append(".WithMessage(");
+ innerContext.ExpressionBuilder.Append(expression);
+ innerContext.ExpressionBuilder.Append(")");
+ var inner = new global::MyNamespace.ExceptionMessageEqualsAssertion(innerContext, expectedMessage, comparison);
+ var __tunit_should_because = source.ConsumeBecauseMessage();
+ if (__tunit_should_because is not null)
+ {
+ inner.Because(__tunit_should_because);
+ }
+ return new global::TUnit.Assertions.Should.Core.ShouldAssertion(innerContext, inner);
+ }
+}
+
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Overload_with_trailing_optional_constructor_parameter_is_emitted.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Overload_with_trailing_optional_constructor_parameter_is_emitted.DotNet8_0.verified.txt
new file mode 100644
index 0000000000..52ab2f6509
--- /dev/null
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Overload_with_trailing_optional_constructor_parameter_is_emitted.DotNet8_0.verified.txt
@@ -0,0 +1,47 @@
+//
+#pragma warning disable
+#nullable enable
+
+using System;
+using System.Runtime.CompilerServices;
+using TUnit.Assertions.Core;
+using TUnit.Assertions.Should.Core;
+
+namespace TUnit.Assertions.Should.Extensions;
+
+public static partial class ShouldExceptionExtensions
+{
+
+ public static global::TUnit.Assertions.Should.Core.ShouldAssertion WithMessage(this global::TUnit.Assertions.Should.Core.IShouldSource source, string expectedMessage, [global::System.Runtime.CompilerServices.CallerArgumentExpression("expectedMessage")] string? expression = null)
+ where TException : System.Exception
+ {
+ var innerContext = source.Context;
+ innerContext.ExpressionBuilder.Append(".WithMessage(");
+ innerContext.ExpressionBuilder.Append(expression);
+ innerContext.ExpressionBuilder.Append(")");
+ var inner = new global::MyNamespace.ExceptionMessageEqualsAssertion(innerContext, expectedMessage);
+ var __tunit_should_because = source.ConsumeBecauseMessage();
+ if (__tunit_should_because is not null)
+ {
+ inner.Because(__tunit_should_because);
+ }
+ return new global::TUnit.Assertions.Should.Core.ShouldAssertion(innerContext, inner);
+ }
+
+ public static global::TUnit.Assertions.Should.Core.ShouldAssertion WithMessage(this global::TUnit.Assertions.Should.Core.IShouldSource source, string expectedMessage, System.StringComparison comparison, [global::System.Runtime.CompilerServices.CallerArgumentExpression("expectedMessage")] string? expression = null)
+ where TException : System.Exception
+ {
+ var innerContext = source.Context;
+ innerContext.ExpressionBuilder.Append(".WithMessage(");
+ innerContext.ExpressionBuilder.Append(expression);
+ innerContext.ExpressionBuilder.Append(")");
+ var inner = new global::MyNamespace.ExceptionMessageEqualsAssertion(innerContext, expectedMessage, comparison);
+ var __tunit_should_because = source.ConsumeBecauseMessage();
+ if (__tunit_should_because is not null)
+ {
+ inner.Because(__tunit_should_because);
+ }
+ return new global::TUnit.Assertions.Should.Core.ShouldAssertion(innerContext, inner);
+ }
+}
+
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Overload_with_trailing_optional_constructor_parameter_is_emitted.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Overload_with_trailing_optional_constructor_parameter_is_emitted.DotNet9_0.verified.txt
new file mode 100644
index 0000000000..52ab2f6509
--- /dev/null
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Overload_with_trailing_optional_constructor_parameter_is_emitted.DotNet9_0.verified.txt
@@ -0,0 +1,47 @@
+//
+#pragma warning disable
+#nullable enable
+
+using System;
+using System.Runtime.CompilerServices;
+using TUnit.Assertions.Core;
+using TUnit.Assertions.Should.Core;
+
+namespace TUnit.Assertions.Should.Extensions;
+
+public static partial class ShouldExceptionExtensions
+{
+
+ public static global::TUnit.Assertions.Should.Core.ShouldAssertion WithMessage(this global::TUnit.Assertions.Should.Core.IShouldSource source, string expectedMessage, [global::System.Runtime.CompilerServices.CallerArgumentExpression("expectedMessage")] string? expression = null)
+ where TException : System.Exception
+ {
+ var innerContext = source.Context;
+ innerContext.ExpressionBuilder.Append(".WithMessage(");
+ innerContext.ExpressionBuilder.Append(expression);
+ innerContext.ExpressionBuilder.Append(")");
+ var inner = new global::MyNamespace.ExceptionMessageEqualsAssertion(innerContext, expectedMessage);
+ var __tunit_should_because = source.ConsumeBecauseMessage();
+ if (__tunit_should_because is not null)
+ {
+ inner.Because(__tunit_should_because);
+ }
+ return new global::TUnit.Assertions.Should.Core.ShouldAssertion(innerContext, inner);
+ }
+
+ public static global::TUnit.Assertions.Should.Core.ShouldAssertion WithMessage(this global::TUnit.Assertions.Should.Core.IShouldSource source, string expectedMessage, System.StringComparison comparison, [global::System.Runtime.CompilerServices.CallerArgumentExpression("expectedMessage")] string? expression = null)
+ where TException : System.Exception
+ {
+ var innerContext = source.Context;
+ innerContext.ExpressionBuilder.Append(".WithMessage(");
+ innerContext.ExpressionBuilder.Append(expression);
+ innerContext.ExpressionBuilder.Append(")");
+ var inner = new global::MyNamespace.ExceptionMessageEqualsAssertion(innerContext, expectedMessage, comparison);
+ var __tunit_should_because = source.ConsumeBecauseMessage();
+ if (__tunit_should_because is not null)
+ {
+ inner.Because(__tunit_should_because);
+ }
+ return new global::TUnit.Assertions.Should.Core.ShouldAssertion(innerContext, inner);
+ }
+}
+
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet10_0.verified.txt
index ac426aeaba..49fe48b1ba 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet10_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet10_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet8_0.verified.txt
index ac426aeaba..49fe48b1ba 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet8_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet9_0.verified.txt
index ac426aeaba..49fe48b1ba 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.ShouldNameAttribute_overrides_conjugation.DotNet9_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet10_0.verified.txt
index ef26605920..f0f5c60c35 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet10_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet10_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet8_0.verified.txt
index ef26605920..f0f5c60c35 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet8_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet9_0.verified.txt
index ef26605920..f0f5c60c35 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.SimpleAssertionExtension_emits_conjugated_extension_method.DotNet9_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet10_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet10_0.verified.txt
index 669ace7528..9fa7d7e7a0 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet10_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet10_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet8_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet8_0.verified.txt
index 669ace7528..9fa7d7e7a0 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet8_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet9_0.verified.txt b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet9_0.verified.txt
index 669ace7528..9fa7d7e7a0 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.Wrapper_generation_deduplicates_overridden_instance_methods.DotNet9_0.verified.txt
@@ -1,4 +1,5 @@
-//
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.cs b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.cs
index 959664a4ca..9ee6ddee35 100644
--- a/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.cs
+++ b/TUnit.Assertions.Should.SourceGenerator.Tests/ShouldExtensionGeneratorTests.cs
@@ -84,6 +84,53 @@ public static MyEqualsAssertion IsEqualTo(
await Assert.That(output).Contains("TValue expected");
}
+ [Test]
+ public async Task Overload_with_trailing_optional_constructor_parameter_is_emitted()
+ {
+ var output = await RunGenerator("""
+ using System;
+ using System.Runtime.CompilerServices;
+ using TUnit.Assertions.Core;
+
+ namespace MyNamespace;
+
+ public class ExceptionMessageEqualsAssertion : Assertion
+ where TException : Exception
+ {
+ public ExceptionMessageEqualsAssertion(
+ AssertionContext context,
+ string expectedMessage,
+ StringComparison comparison = StringComparison.Ordinal)
+ : base(context) { }
+ protected override Task CheckAsync(EvaluationMetadata metadata)
+ => Task.FromResult(AssertionResult.Passed);
+ protected override string GetExpectation() => "to have message";
+ }
+
+ public static class ExceptionExtensions
+ {
+ public static ExceptionMessageEqualsAssertion WithMessage(
+ this IAssertionSource source,
+ string expectedMessage,
+ [CallerArgumentExpression(nameof(expectedMessage))] string? expression = null)
+ where TException : Exception
+ => new(source.Context, expectedMessage);
+
+ public static ExceptionMessageEqualsAssertion WithMessage(
+ this IAssertionSource source,
+ string expectedMessage,
+ StringComparison comparison,
+ [CallerArgumentExpression(nameof(expectedMessage))] string? expression = null)
+ where TException : Exception
+ => new(source.Context, expectedMessage, comparison);
+ }
+ """);
+
+ await Assert.That(output).Contains("WithMessage(this global::TUnit.Assertions.Should.Core.IShouldSource source, string expectedMessage, [global::System.Runtime.CompilerServices.CallerArgumentExpression(\"expectedMessage\")] string? expression = null)");
+ await Assert.That(output).Contains("WithMessage(this global::TUnit.Assertions.Should.Core.IShouldSource source, string expectedMessage, System.StringComparison comparison, [global::System.Runtime.CompilerServices.CallerArgumentExpression(\"expectedMessage\")] string? expression = null)");
+ await Assert.That(output).Contains("new global::MyNamespace.ExceptionMessageEqualsAssertion(innerContext, expectedMessage)");
+ }
+
[Test]
public async Task ShouldNameAttribute_overrides_conjugation()
{
diff --git a/TUnit.Assertions.Should.SourceGenerator/ShouldExtensionGenerator.cs b/TUnit.Assertions.Should.SourceGenerator/ShouldExtensionGenerator.cs
index 8b06374577..50e0e5100c 100644
--- a/TUnit.Assertions.Should.SourceGenerator/ShouldExtensionGenerator.cs
+++ b/TUnit.Assertions.Should.SourceGenerator/ShouldExtensionGenerator.cs
@@ -830,11 +830,12 @@ private static bool HasMatchingConstructor(
INamedTypeSymbol assertionContextSymbol,
List ctorCandidates)
{
+ var minimumParameterCount = ctorCandidates.Count + 1;
foreach (var ctor in returnType.Constructors)
{
if (ctor.DeclaredAccessibility != Accessibility.Public
|| ctor.IsStatic
- || ctor.Parameters.Length != ctorCandidates.Count + 1)
+ || ctor.Parameters.Length < minimumParameterCount)
{
continue;
}
@@ -857,11 +858,29 @@ private static bool HasMatchingConstructor(
break;
}
}
+
+ // Source overloads may intentionally omit simple constructor defaults, such as
+ // StringComparison or comparer parameters. Do not infer hidden boolean/string state:
+ // generated negation and expression parameters require body knowledge to forward.
+ for (var i = minimumParameterCount; allMatch && i < ctor.Parameters.Length; i++)
+ {
+ if (!CanOmitConstructorParameter(ctor.Parameters[i]))
+ {
+ allMatch = false;
+ }
+ }
if (allMatch) return true;
}
return false;
}
+ private static bool CanOmitConstructorParameter(IParameterSymbol parameter)
+ {
+ return parameter.HasExplicitDefaultValue
+ && parameter.Type.SpecialType != SpecialType.System_Boolean
+ && parameter.Type.SpecialType != SpecialType.System_String;
+ }
+
private static string? TryGetShouldNameOverride(INamedTypeSymbol returnType, INamedTypeSymbol? shouldNameAttr)
{
if (shouldNameAttr is null) return null;
@@ -988,6 +1007,7 @@ private static void EmitWrapperPartial(SourceProductionContext ctx, WrapperData
var sb = new StringBuilder();
sb.AppendLine("// ");
+ sb.AppendLine("#pragma warning disable");
sb.AppendLine("#nullable enable");
sb.AppendLine();
sb.AppendLine("using System;");
@@ -1096,6 +1116,7 @@ private static void EmitContainer(SourceProductionContext ctx, string containerN
{
var sb = new StringBuilder();
sb.AppendLine("// ");
+ sb.AppendLine("#pragma warning disable");
sb.AppendLine("#nullable enable");
sb.AppendLine();
sb.AppendLine("using System;");
@@ -1598,6 +1619,7 @@ private static void EmitShouldEntries(SourceProductionContext ctx, ShouldEntryDa
{
var sb = new StringBuilder();
sb.AppendLine("// ");
+ sb.AppendLine("#pragma warning disable");
sb.AppendLine("#nullable enable");
sb.AppendLine();
sb.AppendLine("using System;");
diff --git a/TUnit.Assertions.Should.Tests/DelegateTests.cs b/TUnit.Assertions.Should.Tests/DelegateTests.cs
index 54632b2188..494f6ce176 100644
--- a/TUnit.Assertions.Should.Tests/DelegateTests.cs
+++ b/TUnit.Assertions.Should.Tests/DelegateTests.cs
@@ -43,6 +43,15 @@ public async Task FuncTask_Throw()
await act.Should().Throw();
}
+ [Test]
+ public async Task Throw_WithMessage_without_StringComparison()
+ {
+ Action act = () => throw new InvalidOperationException("data is empty.");
+ await act.Should()
+ .Throw()
+ .WithMessage("data is empty.");
+ }
+
[Test]
public async Task FuncTaskT_NotThrow_returns_value()
{
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.DotNet8_0.verified.txt
index 251c9ef060..095aec2103 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.DotNet8_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.DotNet9_0.verified.txt
index 251c9ef060..095aec2103 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.DotNet9_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.Net4_7.verified.txt
index 251c9ef060..095aec2103 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.Net4_7.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesCharAssertions.Net4_7.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.DotNet8_0.verified.txt
index c1393a0c6f..3428231e99 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.DotNet8_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.DotNet9_0.verified.txt
index c1393a0c6f..3428231e99 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.DotNet9_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.Net4_7.verified.txt
index c1393a0c6f..3428231e99 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.Net4_7.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesEnumAssertions.Net4_7.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.DotNet8_0.verified.txt
index ffdfd688d1..b58512a91e 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.DotNet8_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.DotNet9_0.verified.txt
index ffdfd688d1..b58512a91e 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.DotNet9_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.Net4_7.verified.txt
index ffdfd688d1..b58512a91e 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.Net4_7.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesPathAssertions.Net4_7.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.DotNet8_0.verified.txt
index 756c56f220..bc356939d1 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.DotNet8_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.DotNet9_0.verified.txt
index 756c56f220..bc356939d1 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.DotNet9_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.Net4_7.verified.txt
index 1647e63958..aacce0ccf8 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.Net4_7.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesStringAssertions.Net4_7.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.DotNet8_0.verified.txt
index ce2283989f..f93b690c78 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.DotNet8_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.DotNet8_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.DotNet9_0.verified.txt
index ce2283989f..f93b690c78 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.DotNet9_0.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.DotNet9_0.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.Net4_7.verified.txt
index ce2283989f..f93b690c78 100644
--- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.Net4_7.verified.txt
+++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.GeneratesUriAssertions.Net4_7.verified.txt
@@ -1,4 +1,6 @@
[
+//
+#pragma warning disable
#nullable enable
using System;
diff --git a/TUnit.Core.SourceGenerator/Generators/PropertyInjectionSourceGenerator.cs b/TUnit.Core.SourceGenerator/Generators/PropertyInjectionSourceGenerator.cs
index eaa06041be..6f4aecf601 100644
--- a/TUnit.Core.SourceGenerator/Generators/PropertyInjectionSourceGenerator.cs
+++ b/TUnit.Core.SourceGenerator/Generators/PropertyInjectionSourceGenerator.cs
@@ -750,6 +750,7 @@ private static void GenerateInitializerPropertySource(SourceProductionContext co
var fileName = $"{model.SafeTypeName}_InitializerProperties.g.cs";
var sb = new StringBuilder();
+ WriteGeneratedFileHeader(sb);
sb.AppendLine("using System;");
sb.AppendLine("using TUnit.Core.Discovery;");
sb.AppendLine();
@@ -873,6 +874,7 @@ private static void GenerateGenericInitializerPropertySource(SourceProductionCon
var fileName = $"{model.SafeTypeName}_Generic_InitializerProperties.g.cs";
var sb = new StringBuilder();
+ WriteGeneratedFileHeader(sb);
sb.AppendLine("using System;");
sb.AppendLine("using TUnit.Core.Discovery;");
sb.AppendLine();
@@ -910,6 +912,7 @@ private static void GenerateGenericInitializerPropertySource(SourceProductionCon
private static void WriteFileHeader(StringBuilder sb)
{
+ WriteGeneratedFileHeader(sb);
sb.AppendLine("using System;");
sb.AppendLine("using System.Collections.Generic;");
sb.AppendLine("using TUnit.Core;");
@@ -921,6 +924,13 @@ private static void WriteFileHeader(StringBuilder sb)
sb.AppendLine();
}
+ private static void WriteGeneratedFileHeader(StringBuilder sb)
+ {
+ sb.AppendLine("// ");
+ sb.AppendLine("#pragma warning disable");
+ sb.AppendLine();
+ }
+
private static bool IsPubliclyAccessible(INamedTypeSymbol typeSymbol)
{
if (typeSymbol.DeclaredAccessibility != Accessibility.Public &&
diff --git a/TUnit.Core/AbstractExecutableTest.cs b/TUnit.Core/AbstractExecutableTest.cs
index cb467d1c12..232115a618 100644
--- a/TUnit.Core/AbstractExecutableTest.cs
+++ b/TUnit.Core/AbstractExecutableTest.cs
@@ -30,6 +30,11 @@ public abstract class AbstractExecutableTest
// avoiding a per-test scan over ParallelConstraints in the hot path.
internal bool RequiresGlobalNotInParallelLock { get; set; }
+ // Set by the scheduler for tests that either have dependencies or are the target of
+ // another test's dependency. These tests can be reached from both the scheduler and
+ // dependency recursion, so TestRunner must keep using its execution dedup ledger.
+ internal bool RequiresExecutionDedup { get; set; }
+
public required TestContext Context
{
get;
diff --git a/TUnit.Engine/Scheduling/ConstraintKeyScheduler.cs b/TUnit.Engine/Scheduling/ConstraintKeyScheduler.cs
index e3a3788e4b..d845cb82b6 100644
--- a/TUnit.Engine/Scheduling/ConstraintKeyScheduler.cs
+++ b/TUnit.Engine/Scheduling/ConstraintKeyScheduler.cs
@@ -145,7 +145,7 @@ private async Task ExecuteTestAndReleaseKeysAsync(
{
try
{
- await _testRunner.ExecuteTestAsync(test, cancellationToken).ConfigureAwait(false);
+ await _testRunner.ExecuteTestWithoutExecutionTaskAsync(test, cancellationToken).ConfigureAwait(false);
}
finally
{
diff --git a/TUnit.Engine/Scheduling/TestRunner.cs b/TUnit.Engine/Scheduling/TestRunner.cs
index 0ddbf8e632..09980ddaee 100644
--- a/TUnit.Engine/Scheduling/TestRunner.cs
+++ b/TUnit.Engine/Scheduling/TestRunner.cs
@@ -42,19 +42,48 @@ internal TestRunner(
_notInParallelLock = notInParallelLock;
}
- // Dedup ledger for re-entrant ExecuteTestAsync calls (dependency recursion, scheduler races).
- // Entries are intentionally retained for the session: a late dependency lookup must still
- // observe the in-flight or completed TCS. Session-scoped lifetime bounds growth to O(test count).
+ // Dedup ledger for tests involved in dependency relationships. Entries are intentionally
+ // retained for the session: a late dependency lookup must still observe the in-flight or
+ // completed TCS. Session-scoped lifetime bounds growth to O(test count).
private readonly ConcurrentDictionary> _executingTests = new();
private Exception? _firstFailFastException;
+ internal int ExecutingTestsCount => _executingTests.Count;
+
public ValueTask ExecuteTestAsync(AbstractExecutableTest test, CancellationToken cancellationToken)
+ {
+ if (!test.RequiresExecutionDedup)
+ {
+ if (test.ExecutionTask is { } executionTask)
+ {
+ return new ValueTask(executionTask);
+ }
+
+ return ExecuteTestInternalAsync(test, cancellationToken);
+ }
+
+ return ExecuteTestWithDependenciesAsync(test, cancellationToken);
+ }
+
+ internal ValueTask ExecuteTestWithoutExecutionTaskAsync(AbstractExecutableTest test, CancellationToken cancellationToken)
+ {
+ if (!test.RequiresExecutionDedup)
+ {
+ return ExecuteTestInternalAsync(test, cancellationToken);
+ }
+
+ return ExecuteTestWithDependenciesAsync(test, cancellationToken);
+ }
+
+ private ValueTask ExecuteTestWithDependenciesAsync(AbstractExecutableTest test, CancellationToken cancellationToken)
{
if (_executingTests.TryGetValue(test.TestId, out var existingTcs))
{
return new ValueTask(existingTcs.Task);
}
- var tcs = new TaskCompletionSource();
+ // Continuations may re-enter scheduling paths; keep them off the thread
+ // that publishes ledger completion.
+ var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
existingTcs = _executingTests.GetOrAdd(test.TestId, tcs);
if (existingTcs != tcs)
diff --git a/TUnit.Engine/Scheduling/TestScheduler.cs b/TUnit.Engine/Scheduling/TestScheduler.cs
index 0c855235ff..6376421290 100644
--- a/TUnit.Engine/Scheduling/TestScheduler.cs
+++ b/TUnit.Engine/Scheduling/TestScheduler.cs
@@ -144,6 +144,8 @@ public async Task ScheduleAndExecuteAsync(
// Group tests by their parallel constraints
var groupedTests = await _groupingService.GroupTestsByConstraintsAsync(executableTests).ConfigureAwait(false);
+ MarkDependencyRelatedTestsForExecutionDedup(executableTests);
+
// Suites with no global [NotInParallel] tests skip the runtime exclusion
// lock entirely. Once enabled, the flag is monotonic — dynamic batches
// that introduce NIP later (see ExecuteDynamicBatchAsync) keep it on.
@@ -317,10 +319,54 @@ private async Task ExecuteDynamicBatchAsync(List dynamic
// tests with [NotInParallel(key)], [ParallelGroup(...)] etc. honour their constraints
// instead of being silently dropped.
var groupedDynamicTests = await _groupingService.GroupTestsByConstraintsAsync(dynamicTests.ToArray()).ConfigureAwait(false);
+ MarkDependencyRelatedTestsForExecutionDedup(dynamicTests);
MarkGlobalNotInParallelTests(groupedDynamicTests);
await ExecuteAllPhasesAsync(groupedDynamicTests, cancellationToken).ConfigureAwait(false);
}
+ internal static void MarkDependencyRelatedTestsForExecutionDedup(IEnumerable tests)
+ {
+ HashSet? visitedDependencyTargets = null;
+ Stack? pendingDependencyTargets = null;
+
+ foreach (var test in tests)
+ {
+ if (test.Dependencies.Length == 0)
+ {
+ continue;
+ }
+
+ test.RequiresExecutionDedup = true;
+
+ visitedDependencyTargets ??= [];
+ // Shared across roots so a common dependency target is marked once even
+ // when multiple scheduled tests reference it.
+ pendingDependencyTargets ??= [];
+
+ foreach (var dependency in test.Dependencies)
+ {
+ pendingDependencyTargets.Push(dependency.Test);
+ }
+
+ while (pendingDependencyTargets.Count > 0)
+ {
+ var dependencyTarget = pendingDependencyTargets.Pop();
+
+ if (!visitedDependencyTargets.Add(dependencyTarget))
+ {
+ continue;
+ }
+
+ dependencyTarget.RequiresExecutionDedup = true;
+
+ foreach (var nestedDependency in dependencyTarget.Dependencies)
+ {
+ pendingDependencyTargets.Push(nestedDependency.Test);
+ }
+ }
+ }
+ }
+
private void MarkGlobalNotInParallelTests(GroupedTests grouped)
{
if (grouped.NotInParallel.Length == 0)
@@ -362,8 +408,7 @@ private async Task ExecuteSequentiallyAsync(
{
foreach (var test in tests)
{
- test.ExecutionTask ??= _testRunner.ExecuteTestAsync(test, cancellationToken).AsTask();
- await test.ExecutionTask.ConfigureAwait(false);
+ await ExecuteScheduledTestAsync(test, cancellationToken).ConfigureAwait(false);
}
}
@@ -381,8 +426,7 @@ private Task ExecuteWithGlobalLimitAsync(
},
async (test, ct) =>
{
- test.ExecutionTask ??= _testRunner.ExecuteTestAsync(test, ct).AsTask();
- await test.ExecutionTask.ConfigureAwait(false);
+ await ExecuteScheduledTestAsync(test, ct).ConfigureAwait(false);
}
);
}
@@ -402,8 +446,7 @@ private async Task ExecuteWithGlobalLimitAsync(
await globalSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
- test.ExecutionTask ??= _testRunner.ExecuteTestAsync(test, cancellationToken).AsTask();
- await test.ExecutionTask.ConfigureAwait(false);
+ await ExecuteScheduledTestAsync(test, cancellationToken).ConfigureAwait(false);
}
finally
{
@@ -415,6 +458,20 @@ private async Task ExecuteWithGlobalLimitAsync(
}
#endif
+ private async ValueTask ExecuteScheduledTestAsync(AbstractExecutableTest test, CancellationToken cancellationToken)
+ {
+ if (!test.RequiresExecutionDedup)
+ {
+ await _testRunner.ExecuteTestAsync(test, cancellationToken).ConfigureAwait(false);
+ return;
+ }
+
+ // Dependency recursion is the re-entrant path. Only those tests reuse the
+ // scheduler task slot; independent tests may also use it for constraint wrappers.
+ test.ExecutionTask ??= _testRunner.ExecuteTestAsync(test, cancellationToken).AsTask();
+ await test.ExecutionTask.ConfigureAwait(false);
+ }
+
// The cancellation token is forwarded only so WaitForTasksWithFailFastHandling can
// distinguish a fail-fast cancellation from a normal task fault when both phases run.
// Tasks `a` and `b` are already started and carry their own token internally, so the
diff --git a/TUnit.Engine/Services/ObjectLifecycleService.cs b/TUnit.Engine/Services/ObjectLifecycleService.cs
index c8433af372..3d2eef9f65 100644
--- a/TUnit.Engine/Services/ObjectLifecycleService.cs
+++ b/TUnit.Engine/Services/ObjectLifecycleService.cs
@@ -250,7 +250,9 @@ private async Task InitializeTrackedObjectsAsync(TestContext testContext, Cancel
var tasks = new List(objectsAtLevel.Count);
foreach (var obj in objectsAtLevel)
{
- tasks.Add(InitializeObjectWithSpanAsync(obj, testContext, cancellationToken));
+ // Tracked objects were discovered before execution and are already
+ // ordered deepest-first, so nested graph traversal would be redundant.
+ tasks.Add(InitializeObjectWithSpanAsync(obj, testContext, cancellationToken, includeNestedObjects: false));
}
if (tasks.Count > 0)
@@ -268,11 +270,18 @@ private async Task InitializeTrackedObjectsAsync(TestContext testContext, Cancel
///
/// Initializes an object and its nested objects, wrapped in a scope-aware OpenTelemetry span.
+ /// Used for objects outside the tracked graph, such as the test class instance.
///
- private async Task InitializeObjectWithSpanAsync(object obj, TestContext testContext, CancellationToken cancellationToken)
+ private async Task InitializeObjectWithSpanAsync(
+ object obj,
+ TestContext testContext,
+ CancellationToken cancellationToken,
+ bool includeNestedObjects = true)
{
- // First initialize nested objects depth-first
- await InitializeNestedObjectsForExecutionAsync(obj, cancellationToken);
+ if (includeNestedObjects)
+ {
+ await InitializeNestedObjectsForExecutionAsync(obj, cancellationToken);
+ }
#if NET
var sharedType = TraceScopeRegistry.GetSharedType(obj);
@@ -299,6 +308,7 @@ private async Task InitializeObjectWithSpanAsync(object obj, TestContext testCon
await ObjectInitializer.InitializeAsync(obj, cancellationToken);
}
#else
+ _ = testContext;
await ObjectInitializer.InitializeAsync(obj, cancellationToken);
#endif
}
diff --git a/TUnit.Example.Asp.Net.TestProject/FactoryMethodOrderTests.cs b/TUnit.Example.Asp.Net.TestProject/FactoryMethodOrderTests.cs
index 1c8540e9d7..b38605849c 100644
--- a/TUnit.Example.Asp.Net.TestProject/FactoryMethodOrderTests.cs
+++ b/TUnit.Example.Asp.Net.TestProject/FactoryMethodOrderTests.cs
@@ -4,9 +4,10 @@ namespace TUnit.Example.Asp.Net.TestProject;
/// Tests verifying the execution order of WebApplicationFactory methods
/// relative to WebApplicationTest hooks.
///
-/// Factory methods run after SetupAsync but before test-specific configuration:
-/// - Factory.ConfigureWebHost (order 3)
-/// - Factory.ConfigureStartupConfiguration (order 4)
+/// Factory methods are called when the shared factory is initialized.
+/// Per-test web host builder configuration runs after SetupAsync but before
+/// test-specific configuration:
+/// - ConfigureWebHostBuilder (order 3)
///
/// This allows:
/// - Factory to provide base configuration shared across tests
@@ -35,19 +36,18 @@ await Assert.That(GlobalFactory.ConfigureStartupConfigurationCallCount).IsGreate
}
[Test]
- [DisplayName("Factory.ConfigureWebHost runs after SetupAsync")]
- public async Task Factory_ConfigureWebHost_Runs_After_SetupAsync()
+ [DisplayName("ConfigureWebHostBuilder runs after SetupAsync")]
+ public async Task ConfigureWebHostBuilder_Runs_After_SetupAsync()
{
_ = Factory.CreateClient();
- // Note: Factory order tracking only works reliably when this test triggers factory initialization
- // If factory was already initialized, these values are from a previous test's counter
- if (FactoryConfigureWebHostCalledOrder > 0)
- {
- await Assert.That(FactoryConfigureWebHostCalledOrder)
- .IsGreaterThan(SetupCalledOrder)
- .Because("Factory methods run after SetupAsync (during factory access)");
- }
+ await Assert.That(GlobalFactory.ConfigureWebHostCallCount)
+ .IsGreaterThan(0)
+ .Because("ConfigureWebHost should be called when the shared factory is initialized");
+
+ await Assert.That(ConfigureWebHostBuilderCalledOrder)
+ .IsGreaterThan(SetupCalledOrder)
+ .Because("Per-test web host builder configuration runs after SetupAsync");
}
[Test]
diff --git a/TUnit.Mocks.SourceGenerator.Tests/SnapshotTestBase.cs b/TUnit.Mocks.SourceGenerator.Tests/SnapshotTestBase.cs
index 470fee94ac..5bc99bd07e 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/SnapshotTestBase.cs
+++ b/TUnit.Mocks.SourceGenerator.Tests/SnapshotTestBase.cs
@@ -68,11 +68,21 @@ protected static string[] RunGenerator(
}
return runResult.GeneratedTrees
- .OrderBy(t => t.FilePath, StringComparer.Ordinal)
+ .OrderBy(t => GetGeneratedTreeSortKey(t.FilePath), StringComparer.Ordinal)
.Select(t => t.GetText().ToString())
.ToArray();
}
+ private static string GetGeneratedTreeSortKey(string filePath)
+ {
+ var normalizedPath = filePath.Replace('\\', '/');
+ var fileNameStart = normalizedPath.LastIndexOf('/');
+
+ return fileNameStart >= 0
+ ? normalizedPath[(fileNameStart + 1)..]
+ : normalizedPath;
+ }
+
///
/// Compiles the given source into an in-memory assembly and returns it as a MetadataReference.
/// Useful for simulating external assemblies in tests.
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_Implementing_Static_Abstract_Interface.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_Implementing_Static_Abstract_Interface.verified.txt
index 1381a81357..88d3e7a9a9 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_Implementing_Static_Abstract_Interface.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_Implementing_Static_Abstract_Interface.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -58,6 +59,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -76,6 +78,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -96,6 +99,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Constructor_Parameters_Extension_Discovery.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Constructor_Parameters_Extension_Discovery.verified.txt
index 9219227ce4..917d0a40a8 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Constructor_Parameters_Extension_Discovery.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Constructor_Parameters_Extension_Discovery.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -95,6 +96,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -113,6 +115,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -143,6 +146,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Required_Members.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Required_Members.verified.txt
index 31065db736..3f99453bdd 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Required_Members.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Required_Members.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -46,6 +47,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -59,6 +61,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -79,6 +82,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Same_Arity_Constructor_Overloads.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Same_Arity_Constructor_Overloads.verified.txt
index 3a2564e389..751421a6db 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Same_Arity_Constructor_Overloads.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Class_With_Same_Arity_Constructor_Overloads.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -104,6 +105,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -122,6 +124,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -162,6 +165,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/GenerateMock_Attribute_With_Concrete_Class.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/GenerateMock_Attribute_With_Concrete_Class.verified.txt
index 3439ef3b15..499fccd908 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/GenerateMock_Attribute_With_Concrete_Class.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/GenerateMock_Attribute_With_Concrete_Class.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -64,6 +65,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -88,6 +90,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -108,6 +111,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt
index 152c650bef..2290973ecf 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -22,6 +23,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -82,6 +84,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -290,6 +293,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -310,6 +314,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt
index 2eeb707c50..ae4a321a6b 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -22,6 +23,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -82,6 +84,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -193,6 +196,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -213,6 +217,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Enum_Type_Argument.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Enum_Type_Argument.verified.txt
index 00e41cafab..dd614a4b3b 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Enum_Type_Argument.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Enum_Type_Argument.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -17,6 +18,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -72,6 +74,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -90,6 +93,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -110,6 +114,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt
index 77733d60b2..19d12f1a61 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -17,6 +18,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -72,6 +74,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -187,6 +190,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -207,6 +211,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Generic_Type_Argument.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Generic_Type_Argument.verified.txt
index 37b7d3f691..b94ad71414 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Generic_Type_Argument.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Generic_Type_Argument.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -17,6 +18,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -72,6 +74,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -90,6 +93,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -110,6 +114,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt
index 770804f820..7df96c44ac 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -22,6 +23,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.Sandbox
@@ -82,6 +84,7 @@ namespace TUnit.Mocks.Generated.Sandbox
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -193,6 +196,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -213,6 +217,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt
index 13e666da47..a693ded5b9 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -26,6 +27,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -99,6 +101,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -216,6 +219,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -236,6 +240,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt
index 9395671b43..799d390a67 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -17,6 +18,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -91,6 +93,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -109,6 +112,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -129,6 +133,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -151,6 +156,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -182,6 +188,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -304,6 +311,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -377,6 +385,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -397,6 +406,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_IEnumerable_Generic.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_IEnumerable_Generic.verified.txt
index 97591cbcb9..80be6d3926 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_IEnumerable_Generic.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_IEnumerable_Generic.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -19,6 +20,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -76,6 +78,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -94,6 +97,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -114,6 +118,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt
index 9def41c504..a703d102b4 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -27,6 +28,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -98,6 +100,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -215,6 +218,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -235,6 +239,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Nested_Generic_IEnumerable.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Nested_Generic_IEnumerable.verified.txt
index cfd78034ab..30e2dbaab7 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Nested_Generic_IEnumerable.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Nested_Generic_IEnumerable.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -23,6 +24,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -90,6 +92,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -117,6 +120,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -137,6 +141,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt
index e4db421bbf..47e00bfe8e 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -23,6 +24,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -151,6 +153,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -572,6 +575,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -592,6 +596,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt
index 6566503213..5b85cf06c2 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -22,6 +23,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -53,6 +55,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -137,6 +140,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -250,6 +254,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -270,6 +275,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt
index f2b6b6c937..db09467453 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -27,6 +28,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -113,6 +115,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -168,6 +171,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -188,6 +192,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt
index 2b06cd1232..4caba67245 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -24,6 +25,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -95,6 +97,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -146,6 +149,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -166,6 +170,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Inherited_Static_Abstract_Members.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Inherited_Static_Abstract_Members.verified.txt
index 99e9b7b5b6..8f54ed193a 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Inherited_Static_Abstract_Members.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Inherited_Static_Abstract_Members.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -32,6 +33,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -100,6 +102,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -124,6 +127,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt
index 5b7654446e..23438e4b3e 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -26,6 +27,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -102,6 +104,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -344,6 +347,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -364,6 +368,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt
index 8075626d5b..019a00dc8b 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -22,6 +23,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -88,6 +90,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -318,6 +321,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -338,6 +342,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt
index a9a0c2017b..72b9535752 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -28,6 +29,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -59,6 +61,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -172,6 +175,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -412,6 +416,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -432,6 +437,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Multiple_Multi_Parameter_Events.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Multiple_Multi_Parameter_Events.verified.txt
index 047e9a2696..4bc92a35c9 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Multiple_Multi_Parameter_Events.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Multiple_Multi_Parameter_Events.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -19,6 +20,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -53,6 +55,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -165,6 +168,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -187,6 +191,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -207,6 +212,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event.verified.txt
index 7156534339..7f7bd8e982 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -17,6 +18,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -48,6 +50,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -127,6 +130,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -144,6 +148,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -164,6 +169,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event_And_Nullable_Args.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event_And_Nullable_Args.verified.txt
index c67b15ab2b..d8a1a29413 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event_And_Nullable_Args.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event_And_Nullable_Args.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -17,6 +18,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -48,6 +50,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -127,6 +130,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -144,6 +148,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -164,6 +169,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event_Args.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event_Args.verified.txt
index caf7876e54..10b1fa7cc6 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event_Args.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Event_Args.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -17,6 +18,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -48,6 +50,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -127,6 +130,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -144,6 +148,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -164,6 +169,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt
index f81c28f90d..35417093fc 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -31,6 +32,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -126,6 +128,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -624,6 +627,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -644,6 +648,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_DiagnosticId_NamedArgs.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_DiagnosticId_NamedArgs.verified.txt
index 99758daadb..911b486ce6 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_DiagnosticId_NamedArgs.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_DiagnosticId_NamedArgs.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -18,6 +19,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -80,6 +82,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -98,6 +101,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -118,6 +122,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt
index 9fd5c76dc1..998c0655e0 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -56,6 +57,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -171,6 +173,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -191,6 +194,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -225,6 +229,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -256,6 +261,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -389,6 +395,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -637,6 +644,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -657,6 +665,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt
index 57e605b4ff..01124abc66 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -22,6 +23,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -101,6 +103,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -310,6 +313,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -330,6 +334,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt
index 8cd8afdca6..c80cd9cf35 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -23,6 +24,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -99,6 +101,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -585,6 +588,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -605,6 +609,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Properties.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Properties.verified.txt
index 3cdaa994e2..970f8963a9 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Properties.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Properties.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -21,6 +22,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -93,6 +95,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -117,6 +120,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -137,6 +141,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_RefStruct_Parameters.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_RefStruct_Parameters.verified.txt
index 90f0d248eb..bf76d6c72a 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_RefStruct_Parameters.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_RefStruct_Parameters.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -24,6 +25,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -105,6 +107,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -151,6 +154,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -171,6 +175,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Members.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Members.verified.txt
index 4114bf5a72..3b7f257cab 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Members.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Members.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -48,6 +49,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -116,6 +118,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -146,6 +149,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt
index abb0a774e6..81985574a2 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -19,6 +20,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -85,6 +87,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -212,6 +215,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -232,6 +236,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Unconstrained_Nullable_Generic.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Unconstrained_Nullable_Generic.verified.txt
index 47d48ea923..5888b713f6 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Unconstrained_Nullable_Generic.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Unconstrained_Nullable_Generic.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -21,6 +22,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -105,6 +107,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -135,6 +138,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -155,6 +159,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt
index dee87e6a31..beb8e9a227 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -24,6 +25,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -95,6 +97,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -363,6 +366,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -383,6 +387,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt
index fb3c5eb9c1..fe823153f2 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.ExternalLib
@@ -83,6 +84,7 @@ namespace TUnit.Mocks.Generated.ExternalLib
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -210,6 +212,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -230,6 +233,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt
index 58be91736b..b0b6c58f3f 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.ExternalLib
@@ -55,6 +56,7 @@ namespace TUnit.Mocks.Generated.ExternalLib
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -170,6 +172,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -190,6 +193,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Omits_Inaccessible_Property_Setters.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Omits_Inaccessible_Property_Setters.verified.txt
index fceed0883d..f6f974e3a2 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Omits_Inaccessible_Property_Setters.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Omits_Inaccessible_Property_Setters.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.ExternalLib
@@ -89,6 +90,7 @@ namespace TUnit.Mocks.Generated.ExternalLib
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -113,6 +115,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -133,6 +136,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt
index 1894f961d5..94eb83ae5f 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -78,6 +79,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -135,6 +137,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -155,6 +158,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt
index 64fd05b306..b3efabd6ac 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -82,6 +83,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -312,6 +314,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -332,6 +335,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt
index 68b6fbc859..97c61865c4 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -17,6 +18,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -78,6 +80,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -193,6 +196,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -213,6 +217,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt
index 3a992bb83f..d9240bb070 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -22,6 +23,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -88,6 +90,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -199,6 +202,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks
@@ -219,6 +223,7 @@ namespace TUnit.Mocks
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt
index b81b6b45f7..3f01582c12 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated.ExternalLib
@@ -77,6 +78,7 @@ namespace TUnit.Mocks.Generated.ExternalLib
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -101,6 +103,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt
index 1d5618a378..1bfb09137b 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt
@@ -1,4 +1,5 @@
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -67,6 +68,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated
@@ -105,6 +107,7 @@ namespace TUnit.Mocks.Generated
// ===== FILE SEPARATOR =====
//
+#pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
\ No newline at end of file
diff --git a/TUnit.Mocks.SourceGenerator/Builders/MockBridgeBuilder.cs b/TUnit.Mocks.SourceGenerator/Builders/MockBridgeBuilder.cs
index f57aca84ee..fe48375195 100644
--- a/TUnit.Mocks.SourceGenerator/Builders/MockBridgeBuilder.cs
+++ b/TUnit.Mocks.SourceGenerator/Builders/MockBridgeBuilder.cs
@@ -22,6 +22,7 @@ public static string Build(MockTypeModel model)
var staticEngineTypeName = MockImplBuilder.GetGeneratedTypeName($"{safeName}StaticEngine", model);
writer.AppendLine("// ");
+ writer.AppendLine("#pragma warning disable");
writer.AppendLine("#nullable enable");
writer.AppendLine();
diff --git a/TUnit.Mocks.SourceGenerator/Builders/MockDelegateFactoryBuilder.cs b/TUnit.Mocks.SourceGenerator/Builders/MockDelegateFactoryBuilder.cs
index 666fde8e40..7c6c84e971 100644
--- a/TUnit.Mocks.SourceGenerator/Builders/MockDelegateFactoryBuilder.cs
+++ b/TUnit.Mocks.SourceGenerator/Builders/MockDelegateFactoryBuilder.cs
@@ -14,6 +14,7 @@ public static string Build(MockTypeModel model)
var invokeMethod = model.Methods[0];
writer.AppendLine("// ");
+ writer.AppendLine("#pragma warning disable");
writer.AppendLine("#nullable enable");
writer.AppendLine();
diff --git a/TUnit.Mocks.SourceGenerator/Builders/MockEventsBuilder.cs b/TUnit.Mocks.SourceGenerator/Builders/MockEventsBuilder.cs
index 83666dc228..dc6935a822 100644
--- a/TUnit.Mocks.SourceGenerator/Builders/MockEventsBuilder.cs
+++ b/TUnit.Mocks.SourceGenerator/Builders/MockEventsBuilder.cs
@@ -15,6 +15,7 @@ public static string Build(MockTypeModel model)
var eventsTypeName = MockImplBuilder.GetGeneratedTypeName($"{safeName}_MockEvents", model);
writer.AppendLine("// ");
+ writer.AppendLine("#pragma warning disable");
writer.AppendLine("#nullable enable");
writer.AppendLine();
diff --git a/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs b/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs
index 8c5cd9a2ec..4ae90a943a 100644
--- a/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs
+++ b/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs
@@ -52,6 +52,7 @@ public static string Build(MockTypeModel model)
var hasEvents = instanceEvents.Length > 0;
writer.AppendLine("// ");
+ writer.AppendLine("#pragma warning disable");
writer.AppendLine("#nullable enable");
writer.AppendLine();
diff --git a/TUnit.Mocks.SourceGenerator/Builders/MockStaticExtensionBuilder.cs b/TUnit.Mocks.SourceGenerator/Builders/MockStaticExtensionBuilder.cs
index 748424c496..2fae51b312 100644
--- a/TUnit.Mocks.SourceGenerator/Builders/MockStaticExtensionBuilder.cs
+++ b/TUnit.Mocks.SourceGenerator/Builders/MockStaticExtensionBuilder.cs
@@ -72,6 +72,7 @@ private static string BuildCore(MockTypeModel model, Action");
+ writer.AppendLine("#pragma warning disable");
writer.AppendLine("#nullable enable");
writer.AppendLine();
diff --git a/TUnit.Mocks.SourceGenerator/Builders/MockWrapperTypeBuilder.cs b/TUnit.Mocks.SourceGenerator/Builders/MockWrapperTypeBuilder.cs
index ec58a3872f..00810f2650 100644
--- a/TUnit.Mocks.SourceGenerator/Builders/MockWrapperTypeBuilder.cs
+++ b/TUnit.Mocks.SourceGenerator/Builders/MockWrapperTypeBuilder.cs
@@ -35,6 +35,7 @@ public static string Build(MockTypeModel model)
var constraints = MockImplBuilder.GetConstraintClauses(model);
writer.AppendLine("// ");
+ writer.AppendLine("#pragma warning disable");
writer.AppendLine("#nullable enable");
writer.AppendLine();
diff --git a/TUnit.Mocks.SourceGenerator/MockGenerator.cs b/TUnit.Mocks.SourceGenerator/MockGenerator.cs
index 6dd3c6e98d..73be61e56c 100644
--- a/TUnit.Mocks.SourceGenerator/MockGenerator.cs
+++ b/TUnit.Mocks.SourceGenerator/MockGenerator.cs
@@ -15,6 +15,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
{
ctx.AddSource("TUnit.Mocks.Generated.Namespace.g.cs", """
//
+ #pragma warning disable
#nullable enable
namespace TUnit.Mocks.Generated;
@@ -170,6 +171,7 @@ private static string BuildCombinedImplAndFactory(MockTypeModel model)
var mockNamespace = MockImplBuilder.GetMockNamespace(model);
writer.AppendLine("// ");
+ writer.AppendLine("#pragma warning disable");
writer.AppendLine("#nullable enable");
writer.AppendLine();
diff --git a/TUnit.PublicAPI/Tests.Should_Library_Has_No_API_Changes.DotNet10_0.verified.txt b/TUnit.PublicAPI/Tests.Should_Library_Has_No_API_Changes.DotNet10_0.verified.txt
index 79ad6a363c..ab94717065 100644
--- a/TUnit.PublicAPI/Tests.Should_Library_Has_No_API_Changes.DotNet10_0.verified.txt
+++ b/TUnit.PublicAPI/Tests.Should_Library_Has_No_API_Changes.DotNet10_0.verified.txt
@@ -39,6 +39,7 @@ namespace .
public ..ShouldAssertion<.> BeInDescendingOrder() { }
public ..ShouldAssertion<.> BeInOrder() { }
public ..ShouldAssertion<.> Contain( predicate, [.("predicate")] string? expression = null) { }
+ public ..ShouldAssertion<.> Contain(TItem expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> Contain(TItem expected, . comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> HaveAtLeast(int minCount, [.("minCount")] string? expression = null) { }
public ..ShouldAssertion<.> HaveAtMost(int maxCount, [.("maxCount")] string? expression = null) { }
@@ -48,6 +49,7 @@ namespace .
public ..ShouldAssertion<.> HaveDistinctItems(. comparer, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> HaveSingleItem() { }
public ..ShouldAssertion<.> NotBeEmpty() { }
+ public ..ShouldAssertion<.> NotContain(TItem expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> NotContain(TItem expected, . comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
}
public readonly struct ShouldContinuation : ..IShouldSource, ..IShouldSource
@@ -91,6 +93,7 @@ namespace .
public ..ShouldAssertion<.> BeEmpty() { }
public ..ShouldAssertion<.> BeInDescendingOrder() { }
public ..ShouldAssertion<.> BeInOrder() { }
+ public ..ShouldAssertion<.> Contain(. expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> Contain(<., bool> predicate, [.("predicate")] string? expression = null) { }
public ..ShouldAssertion<.> Contain(. expected, .<.> comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> ContainKey(TKey expectedKey, [.("expectedKey")] string? expression = null) { }
@@ -105,6 +108,7 @@ namespace .
public ..ShouldAssertion<.> HaveDistinctItems(.<.> comparer, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> HaveSingleItem() { }
public ..ShouldAssertion<.> NotBeEmpty() { }
+ public ..ShouldAssertion<.> NotContain(. expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> NotContain(. expected, .<.> comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> NotContainKey(TKey expectedKey, [.("expectedKey")] string? expression = null) { }
public ..ShouldAssertion<.> NotContainValue(TValue expectedValue, [.("expectedValue")] string? expression = null) { }
@@ -128,6 +132,7 @@ namespace .
public ..ShouldAssertion<.> BeInDescendingOrder() { }
public ..ShouldAssertion<.> BeInOrder() { }
public ..ShouldAssertion<.> Contain( predicate, [.("predicate")] string? expression = null) { }
+ public ..ShouldAssertion<.> Contain(TItem expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> Contain(TItem expected, . comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
protected override . CreateSetAdapter(. value) { }
public ..ShouldAssertion<.> HaveAtLeast(int minCount, [.("minCount")] string? expression = null) { }
@@ -138,6 +143,7 @@ namespace .
public ..ShouldAssertion<.> HaveDistinctItems(. comparer, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> HaveSingleItem() { }
public ..ShouldAssertion<.> NotBeEmpty() { }
+ public ..ShouldAssertion<.> NotContain(TItem expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> NotContain(TItem expected, . comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
}
[..ShouldGeneratePartial(typeof(.))]
@@ -152,6 +158,7 @@ namespace .
public ..ShouldAssertion<.> BeEmpty() { }
public ..ShouldAssertion<.> BeInDescendingOrder() { }
public ..ShouldAssertion<.> BeInOrder() { }
+ public ..ShouldAssertion<.> Contain(. expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> Contain(<., bool> predicate, [.("predicate")] string? expression = null) { }
public ..ShouldAssertion<.> Contain(. expected, .<.> comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> ContainKey(TKey expectedKey, [.("expectedKey")] string? expression = null) { }
@@ -166,6 +173,7 @@ namespace .
public ..ShouldAssertion<.> HaveDistinctItems(.<.> comparer, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> HaveSingleItem() { }
public ..ShouldAssertion<.> NotBeEmpty() { }
+ public ..ShouldAssertion<.> NotContain(. expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> NotContain(. expected, .<.> comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> NotContainKey(TKey expectedKey, [.("expectedKey")] string? expression = null) { }
public ..ShouldAssertion<.> NotContainValue(TValue expectedValue, [.("expectedValue")] string? expression = null) { }
@@ -178,6 +186,7 @@ namespace .
public ..ShouldAssertion<.> BeInDescendingOrder() { }
public ..ShouldAssertion<.> BeInOrder() { }
public ..ShouldAssertion<.> Contain( predicate, [.("predicate")] string? expression = null) { }
+ public ..ShouldAssertion<.> Contain(TItem expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> Contain(TItem expected, . comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
protected override . CreateSetAdapter(. value) { }
public ..ShouldAssertion<.> HaveAtLeast(int minCount, [.("minCount")] string? expression = null) { }
@@ -188,6 +197,7 @@ namespace .
public ..ShouldAssertion<.> HaveDistinctItems(. comparer, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> HaveSingleItem() { }
public ..ShouldAssertion<.> NotBeEmpty() { }
+ public ..ShouldAssertion<.> NotContain(TItem expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> NotContain(TItem expected, . comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
}
public abstract class ShouldSetSourceBase : ..ShouldEnumerableSourceBase
@@ -212,6 +222,7 @@ namespace .
public ..ShouldAssertion<.> BeInDescendingOrder() { }
public ..ShouldAssertion<.> BeInOrder() { }
public ..ShouldAssertion<.> Contain( predicate, [.("predicate")] string? expression = null) { }
+ public ..ShouldAssertion<.> Contain(TItem expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> Contain(TItem expected, . comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
protected override . CreateSetAdapter(. value) { }
public ..ShouldAssertion<.> HaveAtLeast(int minCount, [.("minCount")] string? expression = null) { }
@@ -222,6 +233,7 @@ namespace .
public ..ShouldAssertion<.> HaveDistinctItems(. comparer, [.("comparer")] string? comparerExpression = null) { }
public ..ShouldAssertion<.> HaveSingleItem() { }
public ..ShouldAssertion<.> NotBeEmpty() { }
+ public ..ShouldAssertion<.> NotContain(TItem expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.> NotContain(TItem expected, . comparer, [.("expected")] string? expectedExpression = null, [.("comparer")] string? comparerExpression = null) { }
}
public abstract class ShouldSourceBase : ..IShouldSource, ..IShouldSource
@@ -283,11 +295,17 @@ namespace .
public static ..ShouldAssertion Eventually(this ..IShouldSource source, <., .> assertionBuilder, timeout, ? pollingInterval = default, [.("timeout")] string? timeoutExpression = null, [.("pollingInterval")] string? pollingIntervalExpression = null) { }
[("Use Length().IsEqualTo(expectedLength) instead.")]
public static ..ShouldAssertion HaveLength(this ..IShouldSource source, int expectedLength, [.("expectedLength")] string? expression = null) { }
+ public static ..ShouldAssertion HaveMessage(this ..IShouldSource source, string expectedMessage, [.("expectedMessage")] string? expression = null)
+ where TException : { }
public static ..ShouldAssertion HaveMessage(this ..IShouldSource source, string expectedMessage, comparison, [.("expectedMessage")] string? expression = null)
where TException : { }
+ public static ..ShouldAssertion HaveMessageContaining(this ..IShouldSource source, string expectedSubstring, [.("expectedSubstring")] string? expression = null)
+ where TException : { }
public static ..ShouldAssertion HaveMessageContaining(this ..IShouldSource source, string expectedSubstring, comparison, [.("expectedSubstring")] string? expression = null)
where TException : { }
+ public static ..ShouldAssertion HaveMessageEqualTo(this ..IShouldSource source, string expectedMessage) { }
public static ..ShouldAssertion HaveMessageEqualTo(this ..IShouldSource source, string expectedMessage, comparison) { }
+ public static ..ShouldAssertion HaveMessageStartingWith(this ..IShouldSource source, string expectedPrefix) { }
public static ..ShouldAssertion HaveMessageStartingWith(this ..IShouldSource source, string expectedPrefix, comparison) { }
public static ..ShouldAssertion NotBeDefined(this ..IShouldSource source)
where TEnum : struct, { }
@@ -298,16 +316,24 @@ namespace .
public static ..ShouldAssertion WithInnerException(this ..IShouldSource source)
where TException :
where TInnerException : { }
+ public static ..ShouldAssertion WithMessage(this ..IShouldSource source, string expectedMessage, [.("expectedMessage")] string? expression = null)
+ where TException : { }
public static ..ShouldAssertion WithMessage(this ..IShouldSource source, string expectedMessage, comparison, [.("expectedMessage")] string? expression = null)
where TException : { }
+ public static ..ShouldAssertion WithMessageContaining(this ..IShouldSource source, string expectedSubstring, [.("expectedSubstring")] string? expression = null)
+ where TException : { }
public static ..ShouldAssertion WithMessageContaining(this ..IShouldSource source, string expectedSubstring, comparison, [.("expectedSubstring")] string? expression = null)
where TException : { }
public static ..ShouldAssertion WithMessageMatching(this ..IShouldSource source, .StringMatcher matcher, [.("matcher")] string? expression = null)
where TException : { }
public static ..ShouldAssertion WithMessageMatching(this ..IShouldSource source, string pattern, [.("pattern")] string? expression = null)
where TException : { }
+ public static ..ShouldAssertion WithMessageNotContaining(this ..IShouldSource source, string notExpectedSubstring, [.("notExpectedSubstring")] string? expression = null)
+ where TException : { }
public static ..ShouldAssertion WithMessageNotContaining(this ..IShouldSource source, string notExpectedSubstring, comparison, [.("notExpectedSubstring")] string? expression = null)
where TException : { }
+ public static ..ShouldAssertion WithStackTraceContaining(this ..IShouldSource source, string expectedSubstring, [.("expectedSubstring")] string? expression = null)
+ where TException : { }
public static ..ShouldAssertion WithStackTraceContaining(this ..IShouldSource source, string expectedSubstring, comparison, [.("expectedSubstring")] string? expression = null)
where TException : { }
}
diff --git a/TUnit.PublicAPI/Tests.Should_Library_Has_No_API_Changes.DotNet8_0.verified.txt b/TUnit.PublicAPI/Tests.Should_Library_Has_No_API_Changes.DotNet8_0.verified.txt
index 9157d74e63..2c93d0a41e 100644
--- a/TUnit.PublicAPI/Tests.Should_Library_Has_No_API_Changes.DotNet8_0.verified.txt
+++ b/TUnit.PublicAPI/Tests.Should_Library_Has_No_API_Changes.DotNet8_0.verified.txt
@@ -39,6 +39,7 @@ namespace .
public ..ShouldAssertion<.> BeInDescendingOrder() { }
public ..ShouldAssertion<.> BeInOrder() { }
public ..ShouldAssertion<.> Contain( predicate, [.("predicate")] string? expression = null) { }
+ public ..ShouldAssertion<.> Contain(TItem expected, [.("expected")] string? expression = null) { }
public ..ShouldAssertion<.