From 8b4d80878fc7c6e28e79219d3fb16112deaf84e1 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:10:33 +0000 Subject: [PATCH 1/5] fix(mocks): match null literals in predicate overloads (#7306) --- .../Builders/MockMembersBuilder.cs | 7 +- ...losed_Generic_Usages_Snapshot.verified.txt | 8 +- ...thod_Type_Parameters_Snapshot.verified.txt | 174 +++++++++--------- ...s_Back_To_Generated_Namespace.verified.txt | 4 +- ..._Returning_Task_And_ValueTask.verified.txt | 12 +- ...er_Static_Extension_Discovery.verified.txt | 4 +- ...Interface_Extension_Discovery.verified.txt | 8 +- ...face_With_Class_Type_Argument.verified.txt | 4 +- ...le_Non_Builtin_Type_Arguments.verified.txt | 4 +- ...ested_Namespace_Type_Argument.verified.txt | 4 +- ...rectly_Inheriting_IEnumerable.verified.txt | 4 +- ...entUI_Shape_Nullable_Warnings.verified.txt | 28 +-- ...nheriting_Multiple_Interfaces.verified.txt | 4 +- .../Interface_With_Async_Methods.verified.txt | 12 +- ...ultable_Generic_Async_Results.verified.txt | 8 +- .../Interface_With_Events.verified.txt | 4 +- ..._Constraints_On_Explicit_Impl.verified.txt | 4 +- ...nterface_With_Generic_Methods.verified.txt | 12 +- ...ace_With_Keyword_Member_Names.verified.txt | 18 +- ..._With_Keyword_Parameter_Names.verified.txt | 18 +- .../Interface_With_Mixed_Members.verified.txt | 8 +- ..._RefStruct_Out_Ref_Parameters.verified.txt | 4 +- ...ble_Reference_Type_Parameters.verified.txt | 60 +++--- ...terface_With_Obsolete_Members.verified.txt | 22 +-- ...rface_With_Out_Ref_Parameters.verified.txt | 4 +- ...rface_With_Overloaded_Methods.verified.txt | 60 +++--- ...e_With_Params_Array_Parameter.verified.txt | 26 +-- ...stract_Transitive_Return_Type.verified.txt | 4 +- ...ters_Named_Like_Numeric_Types.verified.txt | 12 +- ..._With_Secondary_Setup_Surface.verified.txt | 4 +- .../Multi_Method_Interface.verified.txt | 28 +-- ...embers_From_External_Assembly.verified.txt | 4 +- ...With_Internal_Signature_Types.verified.txt | 4 +- ...c_Constrained_Virtual_Methods.verified.txt | 12 +- ...lsOf_GetHashCodeOf_ToStringOf.verified.txt | 8 +- ...ple_Interface_With_One_Method.verified.txt | 4 +- ...ion_Discovery_Without_Mock_Of.verified.txt | 4 +- ..._Mocked_Regularly_And_Wrapped.verified.txt | 14 +- ...c_Constrained_Virtual_Methods.verified.txt | 8 +- .../NullLiteralMatcherTests.cs | 53 ++++++ 40 files changed, 369 insertions(+), 315 deletions(-) create mode 100644 tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs diff --git a/src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs b/src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs index c92302750d2..596653ee146 100644 --- a/src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs +++ b/src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs @@ -1251,7 +1251,7 @@ private static void EmitSingleFuncOverload(CodeWriter writer, MockMemberModel me if (funcIndices.Contains(i)) { - paramParts.Add($"global::System.Func<{p.FullyQualifiedType}, bool> {p.Name}"); + paramParts.Add($"global::System.Func<{p.FullyQualifiedType}, bool>? {p.Name}"); } else if (p.IsRefStruct) { @@ -1300,12 +1300,13 @@ private static void EmitSingleFuncOverload(CodeWriter writer, MockMemberModel me EmitOutParamDefaults(writer, method); - // Convert Func params to Arg via implicit conversion + // A null predicate (including null/default literals) means an exact-null matcher. + // Keep non-null predicates on the existing implicit-conversion path. foreach (var idx in funcIndices.OrderBy(i => i)) { var p = method.Parameters[idx]; var rawName = p.Name.StartsWith("@", StringComparison.Ordinal) ? p.Name[1..] : p.Name; - writer.AppendLine($"global::TUnit.Mocks.Arguments.Arg<{p.FullyQualifiedType}> __fa_{rawName} = {p.Name};"); + writer.AppendLine($"global::TUnit.Mocks.Arguments.Arg<{p.FullyQualifiedType}> __fa_{rawName} = {p.Name} is null ? global::TUnit.Mocks.Arguments.Arg.IsNull<{p.FullyQualifiedType}>() : (global::TUnit.Mocks.Arguments.Arg<{p.FullyQualifiedType}>){p.Name};"); } // Build matchers array diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Closed_Generic_Usages_Snapshot.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Closed_Generic_Usages_Snapshot.verified.txt index 13cb9b2a30e..f743fd3a77b 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Closed_Generic_Usages_Snapshot.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Closed_Generic_Usages_Snapshot.verified.txt @@ -127,9 +127,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IPair_TKey_TValue__Get_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Get", matchers); } - public static TestNamespace_IPair_TKey_TValue__Get_M0_MockCall Get(this global::TUnit.Mocks.Mock> mock, global::System.Func key) + public static TestNamespace_IPair_TKey_TValue__Get_M0_MockCall Get(this global::TUnit.Mocks.Mock> mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new TestNamespace_IPair_TKey_TValue__Get_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Get", matchers); } @@ -329,9 +329,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IRepository_T__Find_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Find", matchers); } - public static TestNamespace_IRepository_T__Find_M0_MockCall Find(this global::TUnit.Mocks.Mock> mock, global::System.Func id) + public static TestNamespace_IRepository_T__Find_M0_MockCall Find(this global::TUnit.Mocks.Mock> mock, global::System.Func? id) { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new TestNamespace_IRepository_T__Find_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Find", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Colliding_Method_Type_Parameters_Snapshot.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Colliding_Method_Type_Parameters_Snapshot.verified.txt index 857a844445e..2563dd30f26 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Colliding_Method_Type_Parameters_Snapshot.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Colliding_Method_Type_Parameters_Snapshot.verified.txt @@ -74,10 +74,10 @@ namespace TestNamespace return new TestNamespace_IConstrained_T__Select_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Select", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IConstrained_T__Select_M0_MockCall Select(global::System.Func value) where TOther : TMethod + public TestNamespace_IConstrained_T__Select_M0_MockCall Select(global::System.Func? value) where TOther : TMethod { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IConstrained_T__Select_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Select", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -159,9 +159,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IConstrained_T__Select_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Select", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IConstrained_T__Select_M0_MockCall Select(global::System.Func value) where TOther : TMethod + public TestNamespace_IConstrained_T__Select_M0_MockCall Select(global::System.Func? value) where TOther : TMethod { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IConstrained_T__Select_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Select", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -174,9 +174,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IConstrained_T__Select_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Select", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IConstrained_T__Select_M0_MockCall Select(global::System.Func value) where TOther : TMethod + public TestNamespace_IConstrained_T__Select_M0_MockCall Select(global::System.Func? value) where TOther : TMethod { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IConstrained_T__Select_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Select", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -312,10 +312,10 @@ namespace TestNamespace return new TestNamespace_IMethodNamed_T__TMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TMethod", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IMethodNamed_T__TMethod_M0_MockCall TMethod(global::System.Func value) + public TestNamespace_IMethodNamed_T__TMethod_M0_MockCall TMethod(global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IMethodNamed_T__TMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TMethod", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -397,9 +397,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IMethodNamed_T__TMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TMethod", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IMethodNamed_T__TMethod_M0_MockCall TMethod(global::System.Func value) + public TestNamespace_IMethodNamed_T__TMethod_M0_MockCall TMethod(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IMethodNamed_T__TMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TMethod", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -412,9 +412,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IMethodNamed_T__TMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TMethod", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IMethodNamed_T__TMethod_M0_MockCall TMethod(global::System.Func value) + public TestNamespace_IMethodNamed_T__TMethod_M0_MockCall TMethod(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IMethodNamed_T__TMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TMethod", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -540,10 +540,10 @@ namespace TestNamespace return new TestNamespace_IOutbox_T__Invoke_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IOutbox_T__Invoke_M1_MockCall Invoke(global::System.Func message) + public TestNamespace_IOutbox_T__Invoke_M1_MockCall Invoke(global::System.Func? message) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_message = message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new TestNamespace_IOutbox_T__Invoke_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -632,9 +632,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IOutbox_T__Invoke_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IOutbox_T__Invoke_M1_MockCall Invoke(global::System.Func message) + public TestNamespace_IOutbox_T__Invoke_M1_MockCall Invoke(global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new TestNamespace_IOutbox_T__Invoke_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -647,9 +647,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IOutbox_T__Invoke_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IOutbox_T__Invoke_M1_MockCall Invoke(global::System.Func message) + public TestNamespace_IOutbox_T__Invoke_M1_MockCall Invoke(global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new TestNamespace_IOutbox_T__Invoke_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -791,27 +791,27 @@ namespace TestNamespace return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func TMethod, global::TUnit.Mocks.Arguments.Arg value) + public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::TUnit.Mocks.Arguments.Arg value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::TUnit.Mocks.Arguments.Arg TMethod, global::System.Func value) + public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::TUnit.Mocks.Arguments.Arg TMethod, global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func TMethod, global::System.Func value) + public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -893,24 +893,24 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func TMethod, global::TUnit.Mocks.Arguments.Arg value) + public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::TUnit.Mocks.Arguments.Arg value) { - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::TUnit.Mocks.Arguments.Arg TMethod, global::System.Func value) + public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::TUnit.Mocks.Arguments.Arg TMethod, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func TMethod, global::System.Func value) + public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -923,24 +923,24 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func TMethod, global::TUnit.Mocks.Arguments.Arg value) + public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::TUnit.Mocks.Arguments.Arg value) { - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::TUnit.Mocks.Arguments.Arg TMethod, global::System.Func value) + public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::TUnit.Mocks.Arguments.Arg TMethod, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func TMethod, global::System.Func value) + public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1069,27 +1069,27 @@ namespace TestNamespace return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func key, global::TUnit.Mocks.Arguments.Arg value) where TKey : notnull + public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::TUnit.Mocks.Arguments.Arg value) where TKey : notnull { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Put_M0_MockCall Put(global::TUnit.Mocks.Arguments.Arg key, global::System.Func value) where TKey : notnull + public TestNamespace_IStore_T__Put_M0_MockCall Put(global::TUnit.Mocks.Arguments.Arg key, global::System.Func? value) where TKey : notnull { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func key, global::System.Func value) where TKey : notnull + public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::System.Func? value) where TKey : notnull { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_key = key; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1103,10 +1103,10 @@ namespace TestNamespace return new TestNamespace_IStore_T__Convert_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Convert", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Convert_M1_MockCall Convert(global::System.Func value) + public TestNamespace_IStore_T__Convert_M1_MockCall Convert(global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IStore_T__Convert_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Convert", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1193,24 +1193,24 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func key, global::TUnit.Mocks.Arguments.Arg value) where TKey : notnull + public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::TUnit.Mocks.Arguments.Arg value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Put_M0_MockCall Put(global::TUnit.Mocks.Arguments.Arg key, global::System.Func value) where TKey : notnull + public TestNamespace_IStore_T__Put_M0_MockCall Put(global::TUnit.Mocks.Arguments.Arg key, global::System.Func? value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func key, global::System.Func value) where TKey : notnull + public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::System.Func? value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1223,24 +1223,24 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func key, global::TUnit.Mocks.Arguments.Arg value) where TKey : notnull + public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::TUnit.Mocks.Arguments.Arg value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Put_M0_MockCall Put(global::TUnit.Mocks.Arguments.Arg key, global::System.Func value) where TKey : notnull + public TestNamespace_IStore_T__Put_M0_MockCall Put(global::TUnit.Mocks.Arguments.Arg key, global::System.Func? value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func key, global::System.Func value) where TKey : notnull + public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::System.Func? value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1254,9 +1254,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IStore_T__Convert_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Convert", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Convert_M1_MockCall Convert(global::System.Func value) + public TestNamespace_IStore_T__Convert_M1_MockCall Convert(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IStore_T__Convert_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Convert", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1269,9 +1269,9 @@ namespace TUnit.Mocks.Generated return new TestNamespace_IStore_T__Convert_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Convert", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_IStore_T__Convert_M1_MockCall Convert(global::System.Func value) + public TestNamespace_IStore_T__Convert_M1_MockCall Convert(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IStore_T__Convert_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Convert", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1428,27 +1428,27 @@ namespace TestNamespace return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func first, global::TUnit.Mocks.Arguments.Arg second) + public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::TUnit.Mocks.Arguments.Arg second) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_first = first; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::TUnit.Mocks.Arguments.Arg first, global::System.Func second) + public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::TUnit.Mocks.Arguments.Arg first, global::System.Func? second) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_second = second; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func first, global::System.Func second) + public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::System.Func? second) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_first = first; - global::TUnit.Mocks.Arguments.Arg __fa_second = second; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1530,24 +1530,24 @@ namespace TUnit.Mocks.Generated return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func first, global::TUnit.Mocks.Arguments.Arg second) + public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::TUnit.Mocks.Arguments.Arg second) { - global::TUnit.Mocks.Arguments.Arg __fa_first = first; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::TUnit.Mocks.Arguments.Arg first, global::System.Func second) + public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::TUnit.Mocks.Arguments.Arg first, global::System.Func? second) { - global::TUnit.Mocks.Arguments.Arg __fa_second = second; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func first, global::System.Func second) + public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::System.Func? second) { - global::TUnit.Mocks.Arguments.Arg __fa_first = first; - global::TUnit.Mocks.Arguments.Arg __fa_second = second; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1560,24 +1560,24 @@ namespace TUnit.Mocks.Generated return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func first, global::TUnit.Mocks.Arguments.Arg second) + public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::TUnit.Mocks.Arguments.Arg second) { - global::TUnit.Mocks.Arguments.Arg __fa_first = first; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::TUnit.Mocks.Arguments.Arg first, global::System.Func second) + public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::TUnit.Mocks.Arguments.Arg first, global::System.Func? second) { - global::TUnit.Mocks.Arguments.Arg __fa_second = second; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func first, global::System.Func second) + public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::System.Func? second) { - global::TUnit.Mocks.Arguments.Arg __fa_first = first; - global::TUnit.Mocks.Arguments.Arg __fa_second = second; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Conflict_With_Existing_Type_Falls_Back_To_Generated_Namespace.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Conflict_With_Existing_Type_Falls_Back_To_Generated_Namespace.verified.txt index ea9417cfc61..7239e63ff5e 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Conflict_With_Existing_Type_Falls_Back_To_Generated_Namespace.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Conflict_With_Existing_Type_Falls_Back_To_Generated_Namespace.verified.txt @@ -93,9 +93,9 @@ namespace TUnit.Mocks.Generated return new MyApp_IGreeter_Greet_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Greet", matchers); } - public static MyApp_IGreeter_Greet_M0_MockCall Greet(this global::TUnit.Mocks.Mock mock, global::System.Func name) + public static MyApp_IGreeter_Greet_M0_MockCall Greet(this global::TUnit.Mocks.Mock mock, global::System.Func? name) { - global::TUnit.Mocks.Arguments.Arg __fa_name = name; + global::TUnit.Mocks.Arguments.Arg __fa_name = name is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)name; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_name.Matcher }; return new MyApp_IGreeter_Greet_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Greet", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Delegates_Returning_Task_And_ValueTask.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Delegates_Returning_Task_And_ValueTask.verified.txt index 40893341e96..52830f7bdfa 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Delegates_Returning_Task_And_ValueTask.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Delegates_Returning_Task_And_ValueTask.verified.txt @@ -180,9 +180,9 @@ namespace TUnit.Mocks.Generated return new System_Func_int_System_Threading_Tasks_Task__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers); } - public static System_Func_int_System_Threading_Tasks_Task__Invoke_M0_MockCall Invoke(this global::TUnit.Mocks.Mock> mock, global::System.Func arg) + public static System_Func_int_System_Threading_Tasks_Task__Invoke_M0_MockCall Invoke(this global::TUnit.Mocks.Mock> mock, global::System.Func? arg) { - global::TUnit.Mocks.Arguments.Arg __fa_arg = arg; + global::TUnit.Mocks.Arguments.Arg __fa_arg = arg is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_arg.Matcher }; return new System_Func_int_System_Threading_Tasks_Task__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers); } @@ -329,9 +329,9 @@ namespace TUnit.Mocks.Generated return new System_Func_int_System_Threading_Tasks_Task_int__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers); } - public static System_Func_int_System_Threading_Tasks_Task_int__Invoke_M0_MockCall Invoke(this global::TUnit.Mocks.Mock>> mock, global::System.Func arg) + public static System_Func_int_System_Threading_Tasks_Task_int__Invoke_M0_MockCall Invoke(this global::TUnit.Mocks.Mock>> mock, global::System.Func? arg) { - global::TUnit.Mocks.Arguments.Arg __fa_arg = arg; + global::TUnit.Mocks.Arguments.Arg __fa_arg = arg is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_arg.Matcher }; return new System_Func_int_System_Threading_Tasks_Task_int__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers); } @@ -533,9 +533,9 @@ namespace TUnit.Mocks.Generated return new System_Func_string_System_Threading_Tasks_ValueTask_string__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers); } - public static System_Func_string_System_Threading_Tasks_ValueTask_string__Invoke_M0_MockCall Invoke(this global::TUnit.Mocks.Mock>> mock, global::System.Func arg) + public static System_Func_string_System_Threading_Tasks_ValueTask_string__Invoke_M0_MockCall Invoke(this global::TUnit.Mocks.Mock>> mock, global::System.Func? arg) { - global::TUnit.Mocks.Arguments.Arg __fa_arg = arg; + global::TUnit.Mocks.Arguments.Arg __fa_arg = arg is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_arg.Matcher }; return new System_Func_string_System_Threading_Tasks_ValueTask_string__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/External_Interface_With_Indexer_Static_Extension_Discovery.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/External_Interface_With_Indexer_Static_Extension_Discovery.verified.txt index c149d5c5d54..dad30222283 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/External_Interface_With_Indexer_Static_Extension_Discovery.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/External_Interface_With_Indexer_Static_Extension_Discovery.verified.txt @@ -101,9 +101,9 @@ namespace TUnit.Mocks.Generated return new Microsoft_Extensions_Configuration_IConfiguration_GetSectionValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetSectionValue", matchers); } - public static Microsoft_Extensions_Configuration_IConfiguration_GetSectionValue_M0_MockCall GetSectionValue(this global::TUnit.Mocks.Mock mock, global::System.Func key) + public static Microsoft_Extensions_Configuration_IConfiguration_GetSectionValue_M0_MockCall GetSectionValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new Microsoft_Extensions_Configuration_IConfiguration_GetSectionValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetSectionValue", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt index 19f555ee3fb..d157742a9cb 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt @@ -91,9 +91,9 @@ namespace TUnit.Mocks.Generated return new IRepository_T__GetById_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetById", matchers); } - public static IRepository_T__GetById_M0_MockCall GetById(this global::TUnit.Mocks.Mock> mock, global::System.Func id) + public static IRepository_T__GetById_M0_MockCall GetById(this global::TUnit.Mocks.Mock> mock, global::System.Func? id) { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IRepository_T__GetById_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetById", matchers); } @@ -104,9 +104,9 @@ namespace TUnit.Mocks.Generated return new IRepository_T__Save_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Save", matchers); } - public static IRepository_T__Save_M1_MockCall Save(this global::TUnit.Mocks.Mock> mock, global::System.Func entity) + public static IRepository_T__Save_M1_MockCall Save(this global::TUnit.Mocks.Mock> mock, global::System.Func? entity) { - global::TUnit.Mocks.Arguments.Arg __fa_entity = entity; + global::TUnit.Mocks.Arguments.Arg __fa_entity = entity is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)entity; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_entity.Matcher }; return new IRepository_T__Save_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Save", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt index fbd4c2a39c1..41d09e61fbb 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt @@ -97,9 +97,9 @@ namespace TUnit.Mocks.Generated return new Sandbox_IFoo_T__Process_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Process", matchers); } - public static Sandbox_IFoo_T__Process_M1_MockCall Process(this global::TUnit.Mocks.Mock> mock, global::System.Func item) + public static Sandbox_IFoo_T__Process_M1_MockCall Process(this global::TUnit.Mocks.Mock> mock, global::System.Func? item) { - global::TUnit.Mocks.Arguments.Arg __fa_item = item; + global::TUnit.Mocks.Arguments.Arg __fa_item = item is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)item; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_item.Matcher }; return new Sandbox_IFoo_T__Process_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Process", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt index b5ec65ba884..400ff6fb791 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt @@ -87,9 +87,9 @@ namespace TUnit.Mocks.Generated return new Sandbox_IMapper_TIn_TOut__Map_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Map", matchers); } - public static Sandbox_IMapper_TIn_TOut__Map_M0_MockCall Map(this global::TUnit.Mocks.Mock> mock, global::System.Func input) + public static Sandbox_IMapper_TIn_TOut__Map_M0_MockCall Map(this global::TUnit.Mocks.Mock> mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new Sandbox_IMapper_TIn_TOut__Map_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Map", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt index 2d89e17c18a..fb12dc57a41 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt @@ -103,9 +103,9 @@ namespace TUnit.Mocks.Generated return new Sandbox_IService_T__Apply_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Apply", matchers); } - public static Sandbox_IService_T__Apply_M1_MockCall Apply(this global::TUnit.Mocks.Mock> mock, global::System.Func config) + public static Sandbox_IService_T__Apply_M1_MockCall Apply(this global::TUnit.Mocks.Mock> mock, global::System.Func? config) { - global::TUnit.Mocks.Arguments.Arg __fa_config = config; + global::TUnit.Mocks.Arguments.Arg __fa_config = config is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)config; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_config.Matcher }; return new Sandbox_IService_T__Apply_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Apply", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt index 73f5c0b3837..b77f84113da 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt @@ -108,9 +108,9 @@ namespace TUnit.Mocks.Generated return new ICustomCollection_Add_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Add", matchers); } - public static ICustomCollection_Add_M1_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func item) + public static ICustomCollection_Add_M1_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? item) { - global::TUnit.Mocks.Arguments.Arg __fa_item = item; + global::TUnit.Mocks.Arguments.Arg __fa_item = item is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)item; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_item.Matcher }; return new ICustomCollection_Add_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Add", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt index 0ab01f43d07..c428b2e6a5f 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt @@ -404,24 +404,24 @@ namespace TUnit.Mocks.Generated return new IDialogService_UpdateDialogAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "UpdateDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IDialogService_UpdateDialogAsync_M0_MockCall UpdateDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func id, global::TUnit.Mocks.Arguments.Arg> parameters) where TData : class + public static IDialogService_UpdateDialogAsync_M0_MockCall UpdateDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id, global::TUnit.Mocks.Arguments.Arg> parameters) where TData : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher, parameters.Matcher }; return new IDialogService_UpdateDialogAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "UpdateDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IDialogService_UpdateDialogAsync_M0_MockCall UpdateDialogAsync(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg id, global::System.Func, bool> parameters) where TData : class + public static IDialogService_UpdateDialogAsync_M0_MockCall UpdateDialogAsync(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg id, global::System.Func, bool>? parameters) where TData : class { - global::TUnit.Mocks.Arguments.Arg> __fa_parameters = parameters; + global::TUnit.Mocks.Arguments.Arg> __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.IsNull>() : (global::TUnit.Mocks.Arguments.Arg>)parameters; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { id.Matcher, __fa_parameters.Matcher }; return new IDialogService_UpdateDialogAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "UpdateDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IDialogService_UpdateDialogAsync_M0_MockCall UpdateDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func id, global::System.Func, bool> parameters) where TData : class + public static IDialogService_UpdateDialogAsync_M0_MockCall UpdateDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id, global::System.Func, bool>? parameters) where TData : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; - global::TUnit.Mocks.Arguments.Arg> __fa_parameters = parameters; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg> __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.IsNull>() : (global::TUnit.Mocks.Arguments.Arg>)parameters; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher, __fa_parameters.Matcher }; return new IDialogService_UpdateDialogAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "UpdateDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -432,24 +432,24 @@ namespace TUnit.Mocks.Generated return new IDialogService_ShowDialogAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IDialogService_ShowDialogAsync_M1_MockCall ShowDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func data, global::TUnit.Mocks.Arguments.Arg parameters) where TDialog : global::IDialogContentComponent + public static IDialogService_ShowDialogAsync_M1_MockCall ShowDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? data, global::TUnit.Mocks.Arguments.Arg parameters) where TDialog : global::IDialogContentComponent { - global::TUnit.Mocks.Arguments.Arg __fa_data = data; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher, parameters.Matcher }; return new IDialogService_ShowDialogAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IDialogService_ShowDialogAsync_M1_MockCall ShowDialogAsync(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg data, global::System.Func parameters) where TDialog : global::IDialogContentComponent + public static IDialogService_ShowDialogAsync_M1_MockCall ShowDialogAsync(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg data, global::System.Func? parameters) where TDialog : global::IDialogContentComponent { - global::TUnit.Mocks.Arguments.Arg __fa_parameters = parameters; + global::TUnit.Mocks.Arguments.Arg __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)parameters; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { data.Matcher, __fa_parameters.Matcher }; return new IDialogService_ShowDialogAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IDialogService_ShowDialogAsync_M1_MockCall ShowDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func data, global::System.Func parameters) where TDialog : global::IDialogContentComponent + public static IDialogService_ShowDialogAsync_M1_MockCall ShowDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? data, global::System.Func? parameters) where TDialog : global::IDialogContentComponent { - global::TUnit.Mocks.Arguments.Arg __fa_data = data; - global::TUnit.Mocks.Arguments.Arg __fa_parameters = parameters; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; + global::TUnit.Mocks.Arguments.Arg __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)parameters; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher, __fa_parameters.Matcher }; return new IDialogService_ShowDialogAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt index 4f98fb91046..05b92e20a5a 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt @@ -119,9 +119,9 @@ namespace TUnit.Mocks.Generated return new IReadWriter_Write_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Write", matchers); } - public static IReadWriter_Write_M2_MockCall Write(this global::TUnit.Mocks.Mock mock, global::System.Func data) + public static IReadWriter_Write_M2_MockCall Write(this global::TUnit.Mocks.Mock mock, global::System.Func? data) { - global::TUnit.Mocks.Arguments.Arg __fa_data = data; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher }; return new IReadWriter_Write_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Write", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt index 10c01de76a2..65e736d4bda 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt @@ -160,9 +160,9 @@ namespace TUnit.Mocks.Generated return new IAsyncService_GetValueAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetValueAsync", matchers); } - public static IAsyncService_GetValueAsync_M0_MockCall GetValueAsync(this global::TUnit.Mocks.Mock mock, global::System.Func key) + public static IAsyncService_GetValueAsync_M0_MockCall GetValueAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IAsyncService_GetValueAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetValueAsync", matchers); } @@ -179,9 +179,9 @@ namespace TUnit.Mocks.Generated return new IAsyncService_ComputeAsync_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "ComputeAsync", matchers); } - public static IAsyncService_ComputeAsync_M2_MockCall ComputeAsync(this global::TUnit.Mocks.Mock mock, global::System.Func input) + public static IAsyncService_ComputeAsync_M2_MockCall ComputeAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new IAsyncService_ComputeAsync_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "ComputeAsync", matchers); } @@ -192,9 +192,9 @@ namespace TUnit.Mocks.Generated return new IAsyncService_InitializeAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "InitializeAsync", matchers); } - public static IAsyncService_InitializeAsync_M3_MockCall InitializeAsync(this global::TUnit.Mocks.Mock mock, global::System.Func ct) + public static IAsyncService_InitializeAsync_M3_MockCall InitializeAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? ct) { - global::TUnit.Mocks.Arguments.Arg __fa_ct = ct; + global::TUnit.Mocks.Arguments.Arg __fa_ct = ct is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)ct; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_ct.Matcher }; return new IAsyncService_InitializeAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "InitializeAsync", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Enum_And_Defaultable_Generic_Async_Results.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Enum_And_Defaultable_Generic_Async_Results.verified.txt index 23d0227543e..c6572adc44f 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Enum_And_Defaultable_Generic_Async_Results.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Enum_And_Defaultable_Generic_Async_Results.verified.txt @@ -172,9 +172,9 @@ namespace TUnit.Mocks.Generated return new IEnumAndGenericService_FindAsync_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "FindAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IEnumAndGenericService_FindAsync_M2_MockCall FindAsync(this global::TUnit.Mocks.Mock mock, global::System.Func id) + public static IEnumAndGenericService_FindAsync_M2_MockCall FindAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id) { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IEnumAndGenericService_FindAsync_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "FindAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -185,9 +185,9 @@ namespace TUnit.Mocks.Generated return new IEnumAndGenericService_FindStructAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "FindStructAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IEnumAndGenericService_FindStructAsync_M3_MockCall FindStructAsync(this global::TUnit.Mocks.Mock mock, global::System.Func id) where T : struct + public static IEnumAndGenericService_FindStructAsync_M3_MockCall FindStructAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id) where T : struct { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IEnumAndGenericService_FindStructAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "FindStructAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt index 2e26955ac86..fdedb853836 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt @@ -147,9 +147,9 @@ namespace TUnit.Mocks.Generated return new INotifier_Notify_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Notify", matchers); } - public static INotifier_Notify_M0_MockCall Notify(this global::TUnit.Mocks.Mock mock, global::System.Func message) + public static INotifier_Notify_M0_MockCall Notify(this global::TUnit.Mocks.Mock mock, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new INotifier_Notify_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Notify", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt index 3cccac4a534..986814e0a1f 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt @@ -122,9 +122,9 @@ namespace TUnit.Mocks.Generated return new IConstrained_GetNotnull_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetNotnull", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IConstrained_GetNotnull_M0_MockCall GetNotnull(this global::TUnit.Mocks.Mock mock, global::System.Func key) where T : notnull + public static IConstrained_GetNotnull_M0_MockCall GetNotnull(this global::TUnit.Mocks.Mock mock, global::System.Func? key) where T : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IConstrained_GetNotnull_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetNotnull", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt index bec55bab714..6b1baf8adef 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt @@ -104,9 +104,9 @@ namespace TUnit.Mocks.Generated return new IRepository_GetById_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetById", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IRepository_GetById_M0_MockCall GetById(this global::TUnit.Mocks.Mock mock, global::System.Func id) where T : class + public static IRepository_GetById_M0_MockCall GetById(this global::TUnit.Mocks.Mock mock, global::System.Func? id) where T : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IRepository_GetById_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetById", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -117,9 +117,9 @@ namespace TUnit.Mocks.Generated return new IRepository_Save_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Save", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IRepository_Save_M1_MockCall Save(this global::TUnit.Mocks.Mock mock, global::System.Func entity) where T : class, new() + public static IRepository_Save_M1_MockCall Save(this global::TUnit.Mocks.Mock mock, global::System.Func? entity) where T : class, new() { - global::TUnit.Mocks.Arguments.Arg __fa_entity = entity; + global::TUnit.Mocks.Arguments.Arg __fa_entity = entity is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)entity; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_entity.Matcher }; return new IRepository_Save_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Save", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -130,9 +130,9 @@ namespace TUnit.Mocks.Generated return new IRepository_Transform_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Transform", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IRepository_Transform_M2_MockCall Transform(this global::TUnit.Mocks.Mock mock, global::System.Func input) where TInput : notnull where TResult : struct + public static IRepository_Transform_M2_MockCall Transform(this global::TUnit.Mocks.Mock mock, global::System.Func? input) where TInput : notnull where TResult : struct { - global::TUnit.Mocks.Arguments.Arg __fa_input = input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new IRepository_Transform_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Transform", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt index 587632cdee1..d2ecf63f0ed 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt @@ -117,9 +117,9 @@ namespace TUnit.Mocks.Generated return new IEscapedNames_event_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "event", matchers); } - public static IEscapedNames_event_M2_MockCall @event(this global::TUnit.Mocks.Mock mock, global::System.Func @params) + public static IEscapedNames_event_M2_MockCall @event(this global::TUnit.Mocks.Mock mock, global::System.Func? @params) { - global::TUnit.Mocks.Arguments.Arg __fa_params = @params; + global::TUnit.Mocks.Arguments.Arg __fa_params = @params is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@params; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_params.Matcher }; return new IEscapedNames_event_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "event", matchers); } @@ -130,24 +130,24 @@ namespace TUnit.Mocks.Generated return new IEscapedNames_namespace_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "namespace", matchers); } - public static IEscapedNames_namespace_M3_MockCall @namespace(this global::TUnit.Mocks.Mock mock, global::System.Func @new, global::TUnit.Mocks.Arguments.Arg @static) + public static IEscapedNames_namespace_M3_MockCall @namespace(this global::TUnit.Mocks.Mock mock, global::System.Func? @new, global::TUnit.Mocks.Arguments.Arg @static) { - global::TUnit.Mocks.Arguments.Arg __fa_new = @new; + global::TUnit.Mocks.Arguments.Arg __fa_new = @new is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@new; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_new.Matcher, @static.Matcher }; return new IEscapedNames_namespace_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "namespace", matchers); } - public static IEscapedNames_namespace_M3_MockCall @namespace(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg @new, global::System.Func @static) + public static IEscapedNames_namespace_M3_MockCall @namespace(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg @new, global::System.Func? @static) { - global::TUnit.Mocks.Arguments.Arg __fa_static = @static; + global::TUnit.Mocks.Arguments.Arg __fa_static = @static is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@static; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { @new.Matcher, __fa_static.Matcher }; return new IEscapedNames_namespace_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "namespace", matchers); } - public static IEscapedNames_namespace_M3_MockCall @namespace(this global::TUnit.Mocks.Mock mock, global::System.Func @new, global::System.Func @static) + public static IEscapedNames_namespace_M3_MockCall @namespace(this global::TUnit.Mocks.Mock mock, global::System.Func? @new, global::System.Func? @static) { - global::TUnit.Mocks.Arguments.Arg __fa_new = @new; - global::TUnit.Mocks.Arguments.Arg __fa_static = @static; + global::TUnit.Mocks.Arguments.Arg __fa_new = @new is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@new; + global::TUnit.Mocks.Arguments.Arg __fa_static = @static is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@static; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_new.Matcher, __fa_static.Matcher }; return new IEscapedNames_namespace_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "namespace", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt index d8172ce4c6c..2d2666e3c3f 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt @@ -97,9 +97,9 @@ namespace TUnit.Mocks.Generated return new ITest_Test_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Test", matchers); } - public static ITest_Test_M0_MockCall Test(this global::TUnit.Mocks.Mock mock, global::System.Func @event) + public static ITest_Test_M0_MockCall Test(this global::TUnit.Mocks.Mock mock, global::System.Func? @event) { - global::TUnit.Mocks.Arguments.Arg __fa_event = @event; + global::TUnit.Mocks.Arguments.Arg __fa_event = @event is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@event; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_event.Matcher }; return new ITest_Test_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Test", matchers); } @@ -110,24 +110,24 @@ namespace TUnit.Mocks.Generated return new ITest_Get_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Get", matchers); } - public static ITest_Get_M1_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func @class, global::TUnit.Mocks.Arguments.Arg @return) + public static ITest_Get_M1_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func? @class, global::TUnit.Mocks.Arguments.Arg @return) { - global::TUnit.Mocks.Arguments.Arg __fa_class = @class; + global::TUnit.Mocks.Arguments.Arg __fa_class = @class is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@class; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_class.Matcher, @return.Matcher }; return new ITest_Get_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Get", matchers); } - public static ITest_Get_M1_MockCall Get(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg @class, global::System.Func @return) + public static ITest_Get_M1_MockCall Get(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg @class, global::System.Func? @return) { - global::TUnit.Mocks.Arguments.Arg __fa_return = @return; + global::TUnit.Mocks.Arguments.Arg __fa_return = @return is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@return; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { @class.Matcher, __fa_return.Matcher }; return new ITest_Get_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Get", matchers); } - public static ITest_Get_M1_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func @class, global::System.Func @return) + public static ITest_Get_M1_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func? @class, global::System.Func? @return) { - global::TUnit.Mocks.Arguments.Arg __fa_class = @class; - global::TUnit.Mocks.Arguments.Arg __fa_return = @return; + global::TUnit.Mocks.Arguments.Arg __fa_class = @class is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@class; + global::TUnit.Mocks.Arguments.Arg __fa_return = @return is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@return; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_class.Matcher, __fa_return.Matcher }; return new ITest_Get_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Get", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt index c7eee023ccd..69174dcbf3a 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt @@ -182,9 +182,9 @@ namespace TUnit.Mocks.Generated return new IService_GetAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "GetAsync", matchers); } - public static IService_GetAsync_M3_MockCall GetAsync(this global::TUnit.Mocks.Mock mock, global::System.Func id) + public static IService_GetAsync_M3_MockCall GetAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id) { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IService_GetAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "GetAsync", matchers); } @@ -195,9 +195,9 @@ namespace TUnit.Mocks.Generated return new IService_Process_M4_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 4, "Process", matchers); } - public static IService_Process_M4_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func data) + public static IService_Process_M4_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? data) { - global::TUnit.Mocks.Arguments.Arg __fa_data = data; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher }; return new IService_Process_M4_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 4, "Process", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_NonSpan_RefStruct_Out_Ref_Parameters.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_NonSpan_RefStruct_Out_Ref_Parameters.verified.txt index 3460bd045e1..175cb485913 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_NonSpan_RefStruct_Out_Ref_Parameters.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_NonSpan_RefStruct_Out_Ref_Parameters.verified.txt @@ -120,9 +120,9 @@ namespace TUnit.Mocks.Generated return new Sandbox_ICursorParser_TryRead_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TryRead", matchers); } - public static Sandbox_ICursorParser_TryRead_M0_MockCall TryRead(this global::TUnit.Mocks.Mock mock, global::System.Func input) + public static Sandbox_ICursorParser_TryRead_M0_MockCall TryRead(this global::TUnit.Mocks.Mock mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new Sandbox_ICursorParser_TryRead_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TryRead", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt index 063d6e0dfdf..2641389a7dd 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt @@ -135,9 +135,9 @@ namespace TUnit.Mocks.Generated return new IFoo_Bar_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Bar", matchers); } - public static IFoo_Bar_M0_MockCall Bar(this global::TUnit.Mocks.Mock mock, global::System.Func baz) + public static IFoo_Bar_M0_MockCall Bar(this global::TUnit.Mocks.Mock mock, global::System.Func? baz) { - global::TUnit.Mocks.Arguments.Arg __fa_baz = baz; + global::TUnit.Mocks.Arguments.Arg __fa_baz = baz is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)baz; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_baz.Matcher }; return new IFoo_Bar_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Bar", matchers); } @@ -148,24 +148,24 @@ namespace TUnit.Mocks.Generated return new IFoo_GetValue_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "GetValue", matchers); } - public static IFoo_GetValue_M1_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func key, global::TUnit.Mocks.Arguments.Arg count) + public static IFoo_GetValue_M1_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key, global::TUnit.Mocks.Arguments.Arg count) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, count.Matcher }; return new IFoo_GetValue_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "GetValue", matchers); } - public static IFoo_GetValue_M1_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg key, global::System.Func count) + public static IFoo_GetValue_M1_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg key, global::System.Func? count) { - global::TUnit.Mocks.Arguments.Arg __fa_count = count; + global::TUnit.Mocks.Arguments.Arg __fa_count = count is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)count; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { key.Matcher, __fa_count.Matcher }; return new IFoo_GetValue_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "GetValue", matchers); } - public static IFoo_GetValue_M1_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func key, global::System.Func count) + public static IFoo_GetValue_M1_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key, global::System.Func? count) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; - global::TUnit.Mocks.Arguments.Arg __fa_count = count; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_count = count is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)count; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, __fa_count.Matcher }; return new IFoo_GetValue_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "GetValue", matchers); } @@ -183,56 +183,56 @@ namespace TUnit.Mocks.Generated return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } - public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func nonNull, global::TUnit.Mocks.Arguments.Arg nullable, global::TUnit.Mocks.Arguments.Arg obj) + public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? nonNull, global::TUnit.Mocks.Arguments.Arg nullable, global::TUnit.Mocks.Arguments.Arg obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull; + global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nonNull; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_nonNull.Matcher, nullable.Matcher, obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } - public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg nonNull, global::System.Func nullable, global::TUnit.Mocks.Arguments.Arg obj) + public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg nonNull, global::System.Func? nullable, global::TUnit.Mocks.Arguments.Arg obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable; + global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nullable; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { nonNull.Matcher, __fa_nullable.Matcher, obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } - public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func nonNull, global::System.Func nullable, global::TUnit.Mocks.Arguments.Arg obj) + public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? nonNull, global::System.Func? nullable, global::TUnit.Mocks.Arguments.Arg obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull; - global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable; + global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nonNull; + global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nullable; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_nonNull.Matcher, __fa_nullable.Matcher, obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } - public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg nonNull, global::TUnit.Mocks.Arguments.Arg nullable, global::System.Func obj) + public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg nonNull, global::TUnit.Mocks.Arguments.Arg nullable, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { nonNull.Matcher, nullable.Matcher, __fa_obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } - public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func nonNull, global::TUnit.Mocks.Arguments.Arg nullable, global::System.Func obj) + public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? nonNull, global::TUnit.Mocks.Arguments.Arg nullable, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull; - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj; + global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nonNull; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_nonNull.Matcher, nullable.Matcher, __fa_obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } - public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg nonNull, global::System.Func nullable, global::System.Func obj) + public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg nonNull, global::System.Func? nullable, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable; - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj; + global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nullable; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { nonNull.Matcher, __fa_nullable.Matcher, __fa_obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } - public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func nonNull, global::System.Func nullable, global::System.Func obj) + public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? nonNull, global::System.Func? nullable, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull; - global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable; - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj; + global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nonNull; + global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nullable; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_nonNull.Matcher, __fa_nullable.Matcher, __fa_obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } @@ -250,9 +250,9 @@ namespace TUnit.Mocks.Generated return new IFoo_GetAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "GetAsync", matchers); } - public static IFoo_GetAsync_M3_MockCall GetAsync(this global::TUnit.Mocks.Mock mock, global::System.Func key) + public static IFoo_GetAsync_M3_MockCall GetAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IFoo_GetAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "GetAsync", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt index 89f14ada453..6848d3c326e 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt @@ -81,9 +81,9 @@ namespace TUnit.Mocks.Generated return new BaseDialog_Compute_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Compute", matchers); } - public static BaseDialog_Compute_M0_MockCall Compute(this global::TUnit.Mocks.Mock mock, global::System.Func input) + public static BaseDialog_Compute_M0_MockCall Compute(this global::TUnit.Mocks.Mock mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new BaseDialog_Compute_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Compute", matchers); } @@ -409,24 +409,24 @@ namespace TUnit.Mocks.Generated return new IDialogService_Show_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Show", matchers); } - public static IDialogService_Show_M0_MockCall Show(this global::TUnit.Mocks.Mock mock, global::System.Func title, global::TUnit.Mocks.Arguments.Arg message) + public static IDialogService_Show_M0_MockCall Show(this global::TUnit.Mocks.Mock mock, global::System.Func? title, global::TUnit.Mocks.Arguments.Arg message) { - global::TUnit.Mocks.Arguments.Arg __fa_title = title; + global::TUnit.Mocks.Arguments.Arg __fa_title = title is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)title; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_title.Matcher, message.Matcher }; return new IDialogService_Show_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Show", matchers); } - public static IDialogService_Show_M0_MockCall Show(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg title, global::System.Func message) + public static IDialogService_Show_M0_MockCall Show(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg title, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { title.Matcher, __fa_message.Matcher }; return new IDialogService_Show_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Show", matchers); } - public static IDialogService_Show_M0_MockCall Show(this global::TUnit.Mocks.Mock mock, global::System.Func title, global::System.Func message) + public static IDialogService_Show_M0_MockCall Show(this global::TUnit.Mocks.Mock mock, global::System.Func? title, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_title = title; - global::TUnit.Mocks.Arguments.Arg __fa_message = message; + global::TUnit.Mocks.Arguments.Arg __fa_title = title is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)title; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_title.Matcher, __fa_message.Matcher }; return new IDialogService_Show_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Show", matchers); } @@ -444,9 +444,9 @@ namespace TUnit.Mocks.Generated return new IDialogService_ShowPanel_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowPanel", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IDialogService_ShowPanel_M1_MockCall ShowPanel(this global::TUnit.Mocks.Mock mock, global::System.Func data) where TData : class + public static IDialogService_ShowPanel_M1_MockCall ShowPanel(this global::TUnit.Mocks.Mock mock, global::System.Func? data) where TData : class { - global::TUnit.Mocks.Arguments.Arg __fa_data = data; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher }; return new IDialogService_ShowPanel_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowPanel", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt index afe14f7d5f8..5512d520e77 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt @@ -110,9 +110,9 @@ namespace TUnit.Mocks.Generated return new IDictionary_TryGetValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TryGetValue", matchers); } - public static IDictionary_TryGetValue_M0_MockCall TryGetValue(this global::TUnit.Mocks.Mock mock, global::System.Func key) + public static IDictionary_TryGetValue_M0_MockCall TryGetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IDictionary_TryGetValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TryGetValue", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt index 4d530428b5e..9f5e59158a8 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt @@ -108,9 +108,9 @@ namespace TUnit.Mocks.Generated return new IFormatter_Format_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Format", matchers); } - public static IFormatter_Format_M0_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func value) + public static IFormatter_Format_M0_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new IFormatter_Format_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Format", matchers); } @@ -121,9 +121,9 @@ namespace TUnit.Mocks.Generated return new IFormatter_Format_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Format", matchers); } - public static IFormatter_Format_M1_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func value) + public static IFormatter_Format_M1_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new IFormatter_Format_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Format", matchers); } @@ -134,24 +134,24 @@ namespace TUnit.Mocks.Generated return new IFormatter_Format_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Format", matchers); } - public static IFormatter_Format_M2_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func template, global::TUnit.Mocks.Arguments.Arg arg1) + public static IFormatter_Format_M2_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::TUnit.Mocks.Arguments.Arg arg1) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, arg1.Matcher }; return new IFormatter_Format_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Format", matchers); } - public static IFormatter_Format_M2_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::System.Func arg1) + public static IFormatter_Format_M2_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::System.Func? arg1) { - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { template.Matcher, __fa_arg1.Matcher }; return new IFormatter_Format_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Format", matchers); } - public static IFormatter_Format_M2_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func template, global::System.Func arg1) + public static IFormatter_Format_M2_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::System.Func? arg1) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template; - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, __fa_arg1.Matcher }; return new IFormatter_Format_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Format", matchers); } @@ -162,56 +162,56 @@ namespace TUnit.Mocks.Generated return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } - public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func template, global::TUnit.Mocks.Arguments.Arg arg1, global::TUnit.Mocks.Arguments.Arg arg2) + public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::TUnit.Mocks.Arguments.Arg arg1, global::TUnit.Mocks.Arguments.Arg arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, arg1.Matcher, arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } - public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::System.Func arg1, global::TUnit.Mocks.Arguments.Arg arg2) + public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::System.Func? arg1, global::TUnit.Mocks.Arguments.Arg arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { template.Matcher, __fa_arg1.Matcher, arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } - public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func template, global::System.Func arg1, global::TUnit.Mocks.Arguments.Arg arg2) + public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::System.Func? arg1, global::TUnit.Mocks.Arguments.Arg arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template; - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, __fa_arg1.Matcher, arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } - public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::TUnit.Mocks.Arguments.Arg arg1, global::System.Func arg2) + public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::TUnit.Mocks.Arguments.Arg arg1, global::System.Func? arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2; + global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg2; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { template.Matcher, arg1.Matcher, __fa_arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } - public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func template, global::TUnit.Mocks.Arguments.Arg arg1, global::System.Func arg2) + public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::TUnit.Mocks.Arguments.Arg arg1, global::System.Func? arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template; - global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg2; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, arg1.Matcher, __fa_arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } - public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::System.Func arg1, global::System.Func arg2) + public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::System.Func? arg1, global::System.Func? arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1; - global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; + global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg2; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { template.Matcher, __fa_arg1.Matcher, __fa_arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } - public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func template, global::System.Func arg1, global::System.Func arg2) + public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::System.Func? arg1, global::System.Func? arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template; - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1; - global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; + global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg2; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, __fa_arg1.Matcher, __fa_arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Params_Array_Parameter.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Params_Array_Parameter.verified.txt index dd3302483da..86afd3b5ded 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Params_Array_Parameter.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Params_Array_Parameter.verified.txt @@ -108,9 +108,9 @@ namespace TUnit.Mocks.Generated return new IParamsSink_Sum_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Sum", matchers); } - public static IParamsSink_Sum_M0_MockCall Sum(this global::TUnit.Mocks.Mock mock, global::System.Func values) + public static IParamsSink_Sum_M0_MockCall Sum(this global::TUnit.Mocks.Mock mock, global::System.Func? values) { - global::TUnit.Mocks.Arguments.Arg __fa_values = values; + global::TUnit.Mocks.Arguments.Arg __fa_values = values is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)values; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_values.Matcher }; return new IParamsSink_Sum_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Sum", matchers); } @@ -138,9 +138,9 @@ namespace TUnit.Mocks.Generated return new IParamsSink_Render_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Render", matchers); } - public static IParamsSink_Render_M1_MockCall Render(this global::TUnit.Mocks.Mock mock, global::System.Func args) + public static IParamsSink_Render_M1_MockCall Render(this global::TUnit.Mocks.Mock mock, global::System.Func? args) { - global::TUnit.Mocks.Arguments.Arg __fa_args = args; + global::TUnit.Mocks.Arguments.Arg __fa_args = args is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)args; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_args.Matcher }; return new IParamsSink_Render_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Render", matchers); } @@ -168,24 +168,24 @@ namespace TUnit.Mocks.Generated return new IParamsSink_Combine_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Combine", matchers); } - public static IParamsSink_Combine_M2_MockCall Combine(this global::TUnit.Mocks.Mock mock, global::System.Func prefix, global::TUnit.Mocks.Arguments.Arg parts) + public static IParamsSink_Combine_M2_MockCall Combine(this global::TUnit.Mocks.Mock mock, global::System.Func? prefix, global::TUnit.Mocks.Arguments.Arg parts) { - global::TUnit.Mocks.Arguments.Arg __fa_prefix = prefix; + global::TUnit.Mocks.Arguments.Arg __fa_prefix = prefix is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)prefix; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_prefix.Matcher, parts.Matcher }; return new IParamsSink_Combine_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Combine", matchers); } - public static IParamsSink_Combine_M2_MockCall Combine(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg prefix, global::System.Func parts) + public static IParamsSink_Combine_M2_MockCall Combine(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg prefix, global::System.Func? parts) { - global::TUnit.Mocks.Arguments.Arg __fa_parts = parts; + global::TUnit.Mocks.Arguments.Arg __fa_parts = parts is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)parts; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { prefix.Matcher, __fa_parts.Matcher }; return new IParamsSink_Combine_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Combine", matchers); } - public static IParamsSink_Combine_M2_MockCall Combine(this global::TUnit.Mocks.Mock mock, global::System.Func prefix, global::System.Func parts) + public static IParamsSink_Combine_M2_MockCall Combine(this global::TUnit.Mocks.Mock mock, global::System.Func? prefix, global::System.Func? parts) { - global::TUnit.Mocks.Arguments.Arg __fa_prefix = prefix; - global::TUnit.Mocks.Arguments.Arg __fa_parts = parts; + global::TUnit.Mocks.Arguments.Arg __fa_prefix = prefix is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)prefix; + global::TUnit.Mocks.Arguments.Arg __fa_parts = parts is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)parts; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_prefix.Matcher, __fa_parts.Matcher }; return new IParamsSink_Combine_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Combine", matchers); } @@ -220,9 +220,9 @@ namespace TUnit.Mocks.Generated return new IParamsSink_First_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "First", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IParamsSink_First_M3_MockCall First(this global::TUnit.Mocks.Mock mock, global::System.Func items) + public static IParamsSink_First_M3_MockCall First(this global::TUnit.Mocks.Mock mock, global::System.Func? items) { - global::TUnit.Mocks.Arguments.Arg __fa_items = items; + global::TUnit.Mocks.Arguments.Arg __fa_items = items is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)items; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_items.Matcher }; return new IParamsSink_First_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "First", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt index e823569b68d..f5398ff62df 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt @@ -94,9 +94,9 @@ namespace TUnit.Mocks.Generated return new IMyService_GetValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetValue", matchers); } - public static IMyService_GetValue_M0_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func key) + public static IMyService_GetValue_M0_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IMyService_GetValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetValue", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Type_Parameters_Named_Like_Numeric_Types.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Type_Parameters_Named_Like_Numeric_Types.verified.txt index 48b548288aa..8658851c446 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Type_Parameters_Named_Like_Numeric_Types.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Type_Parameters_Named_Like_Numeric_Types.verified.txt @@ -19,10 +19,10 @@ public sealed class INumericNamed_Int32_Mock : global::TUnit.Mocks.Mock(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "RoundtripAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public INumericNamed_Int32__RoundtripAsync_M1_MockCall RoundtripAsync(global::System.Func value) + public INumericNamed_Int32__RoundtripAsync_M1_MockCall RoundtripAsync(global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new INumericNamed_Int32__RoundtripAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "RoundtripAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -137,9 +137,9 @@ namespace TUnit.Mocks.Generated return new INumericNamed_Int32__RoundtripAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "RoundtripAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public INumericNamed_Int32__RoundtripAsync_M1_MockCall RoundtripAsync(global::System.Func value) + public INumericNamed_Int32__RoundtripAsync_M1_MockCall RoundtripAsync(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new INumericNamed_Int32__RoundtripAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "RoundtripAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -152,9 +152,9 @@ namespace TUnit.Mocks.Generated return new INumericNamed_Int32__RoundtripAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "RoundtripAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public INumericNamed_Int32__RoundtripAsync_M1_MockCall RoundtripAsync(global::System.Func value) + public INumericNamed_Int32__RoundtripAsync_M1_MockCall RoundtripAsync(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new INumericNamed_Int32__RoundtripAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "RoundtripAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Interface_Mock_With_Secondary_Setup_Surface.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Interface_Mock_With_Secondary_Setup_Surface.verified.txt index db4dc2bcd11..8546055db0c 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Interface_Mock_With_Secondary_Setup_Surface.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Interface_Mock_With_Secondary_Setup_Surface.verified.txt @@ -97,9 +97,9 @@ namespace TUnit.Mocks.Generated return new IMultiLogger_Log_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Log", matchers); } - public static IMultiLogger_Log_M0_MockCall Log(this global::TUnit.Mocks.Mock mock, global::System.Func message) + public static IMultiLogger_Log_M0_MockCall Log(this global::TUnit.Mocks.Mock mock, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new IMultiLogger_Log_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Log", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt index 977da7fbda5..9caac3404cf 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt @@ -104,24 +104,24 @@ namespace TUnit.Mocks.Generated return new ICalculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } - public static ICalculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func a, global::TUnit.Mocks.Arguments.Arg b) + public static ICalculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::TUnit.Mocks.Arguments.Arg b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, b.Matcher }; return new ICalculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } - public static ICalculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg a, global::System.Func b) + public static ICalculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_b = b; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { a.Matcher, __fa_b.Matcher }; return new ICalculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } - public static ICalculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func a, global::System.Func b) + public static ICalculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a; - global::TUnit.Mocks.Arguments.Arg __fa_b = b; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, __fa_b.Matcher }; return new ICalculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } @@ -139,24 +139,24 @@ namespace TUnit.Mocks.Generated return new ICalculator_Subtract_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Subtract", matchers); } - public static ICalculator_Subtract_M1_MockCall Subtract(this global::TUnit.Mocks.Mock mock, global::System.Func a, global::TUnit.Mocks.Arguments.Arg b) + public static ICalculator_Subtract_M1_MockCall Subtract(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::TUnit.Mocks.Arguments.Arg b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, b.Matcher }; return new ICalculator_Subtract_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Subtract", matchers); } - public static ICalculator_Subtract_M1_MockCall Subtract(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg a, global::System.Func b) + public static ICalculator_Subtract_M1_MockCall Subtract(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_b = b; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { a.Matcher, __fa_b.Matcher }; return new ICalculator_Subtract_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Subtract", matchers); } - public static ICalculator_Subtract_M1_MockCall Subtract(this global::TUnit.Mocks.Mock mock, global::System.Func a, global::System.Func b) + public static ICalculator_Subtract_M1_MockCall Subtract(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a; - global::TUnit.Mocks.Arguments.Arg __fa_b = b; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, __fa_b.Matcher }; return new ICalculator_Subtract_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Subtract", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt index bf4f27104cd..2aa63658688 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt @@ -111,9 +111,9 @@ namespace TUnit.Mocks.Generated return new ExternalLib_ExternalClient_PublicMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "PublicMethod", matchers); } - public static ExternalLib_ExternalClient_PublicMethod_M0_MockCall PublicMethod(this global::TUnit.Mocks.Mock mock, global::System.Func input) + public static ExternalLib_ExternalClient_PublicMethod_M0_MockCall PublicMethod(this global::TUnit.Mocks.Mock mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new ExternalLib_ExternalClient_PublicMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "PublicMethod", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt index 18bd74095fb..c1c71289a91 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt @@ -83,9 +83,9 @@ namespace TUnit.Mocks.Generated return new ExternalLib_ServiceClient_GetValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetValue", matchers); } - public static ExternalLib_ServiceClient_GetValue_M0_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func key) + public static ExternalLib_ServiceClient_GetValue_M0_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new ExternalLib_ServiceClient_GetValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetValue", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt index b1dfc95cbea..5b679d8caaf 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt @@ -103,9 +103,9 @@ namespace TUnit.Mocks.Generated return new BaseService_GetById_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetById", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static BaseService_GetById_M0_MockCall GetById(this global::TUnit.Mocks.Mock mock, global::System.Func id) where T : class + public static BaseService_GetById_M0_MockCall GetById(this global::TUnit.Mocks.Mock mock, global::System.Func? id) where T : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new BaseService_GetById_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetById", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -116,9 +116,9 @@ namespace TUnit.Mocks.Generated return new BaseService_Save_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Save", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static BaseService_Save_M1_MockCall Save(this global::TUnit.Mocks.Mock mock, global::System.Func entity) where T : class, new() + public static BaseService_Save_M1_MockCall Save(this global::TUnit.Mocks.Mock mock, global::System.Func? entity) where T : class, new() { - global::TUnit.Mocks.Arguments.Arg __fa_entity = entity; + global::TUnit.Mocks.Arguments.Arg __fa_entity = entity is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)entity; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_entity.Matcher }; return new BaseService_Save_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Save", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -129,9 +129,9 @@ namespace TUnit.Mocks.Generated return new BaseService_Transform_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Transform", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static BaseService_Transform_M2_MockCall Transform(this global::TUnit.Mocks.Mock mock, global::System.Func input) where TInput : notnull where TResult : struct + public static BaseService_Transform_M2_MockCall Transform(this global::TUnit.Mocks.Mock mock, global::System.Func? input) where TInput : notnull where TResult : struct { - global::TUnit.Mocks.Arguments.Arg __fa_input = input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new BaseService_Transform_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Transform", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt index 1e5dd9af510..76e0040d1ed 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt @@ -117,9 +117,9 @@ namespace TUnit.Mocks.Generated return new SelfEquatableSnapshot_Equals_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Equals", matchers); } - public static SelfEquatableSnapshot_Equals_M0_MockCall EqualsOf(this global::TUnit.Mocks.Mock mock, global::System.Func other) + public static SelfEquatableSnapshot_Equals_M0_MockCall EqualsOf(this global::TUnit.Mocks.Mock mock, global::System.Func? other) { - global::TUnit.Mocks.Arguments.Arg __fa_other = other; + global::TUnit.Mocks.Arguments.Arg __fa_other = other is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)other; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_other.Matcher }; return new SelfEquatableSnapshot_Equals_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Equals", matchers); } @@ -130,9 +130,9 @@ namespace TUnit.Mocks.Generated return new SelfEquatableSnapshot_Equals_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Equals", matchers); } - public static SelfEquatableSnapshot_Equals_M1_MockCall EqualsOf(this global::TUnit.Mocks.Mock mock, global::System.Func obj) + public static SelfEquatableSnapshot_Equals_M1_MockCall EqualsOf(this global::TUnit.Mocks.Mock mock, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_obj.Matcher }; return new SelfEquatableSnapshot_Equals_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Equals", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt index f0ee1f4db4b..f4e3e13d0af 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt @@ -87,9 +87,9 @@ namespace TUnit.Mocks.Generated return new IGreeter_Greet_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Greet", matchers); } - public static IGreeter_Greet_M0_MockCall Greet(this global::TUnit.Mocks.Mock mock, global::System.Func name) + public static IGreeter_Greet_M0_MockCall Greet(this global::TUnit.Mocks.Mock mock, global::System.Func? name) { - global::TUnit.Mocks.Arguments.Arg __fa_name = name; + global::TUnit.Mocks.Arguments.Arg __fa_name = name is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)name; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_name.Matcher }; return new IGreeter_Greet_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Greet", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt index 891674a791a..99c0b6ca063 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt @@ -97,9 +97,9 @@ namespace TUnit.Mocks.Generated return new INotifier_Notify_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Notify", matchers); } - public static INotifier_Notify_M0_MockCall Notify(this global::TUnit.Mocks.Mock mock, global::System.Func message) + public static INotifier_Notify_M0_MockCall Notify(this global::TUnit.Mocks.Mock mock, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new INotifier_Notify_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Notify", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Type_Mocked_Regularly_And_Wrapped.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Type_Mocked_Regularly_And_Wrapped.verified.txt index e2f808ec91c..2ba28b7a8c4 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Type_Mocked_Regularly_And_Wrapped.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Type_Mocked_Regularly_And_Wrapped.verified.txt @@ -110,24 +110,24 @@ namespace TUnit.Mocks.Generated return new TestNamespace_Calculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } - public static TestNamespace_Calculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func a, global::TUnit.Mocks.Arguments.Arg b) + public static TestNamespace_Calculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::TUnit.Mocks.Arguments.Arg b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, b.Matcher }; return new TestNamespace_Calculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } - public static TestNamespace_Calculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg a, global::System.Func b) + public static TestNamespace_Calculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_b = b; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { a.Matcher, __fa_b.Matcher }; return new TestNamespace_Calculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } - public static TestNamespace_Calculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func a, global::System.Func b) + public static TestNamespace_Calculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a; - global::TUnit.Mocks.Arguments.Arg __fa_b = b; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, __fa_b.Matcher }; return new TestNamespace_Calculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt index e99d5a33ffc..71fcf4956cc 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt @@ -12,9 +12,9 @@ namespace TUnit.Mocks.Generated return new Repository_Get_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Get", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static Repository_Get_M0_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func id) where T : class + public static Repository_Get_M0_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func? id) where T : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new Repository_Get_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Get", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -25,9 +25,9 @@ namespace TUnit.Mocks.Generated return new Repository_Store_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Store", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static Repository_Store_M1_MockCall Store(this global::TUnit.Mocks.Mock mock, global::System.Func item) where T : class, new() + public static Repository_Store_M1_MockCall Store(this global::TUnit.Mocks.Mock mock, global::System.Func? item) where T : class, new() { - global::TUnit.Mocks.Arguments.Arg __fa_item = item; + global::TUnit.Mocks.Arguments.Arg __fa_item = item is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)item; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_item.Matcher }; return new Repository_Store_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Store", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs b/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs new file mode 100644 index 00000000000..22b9c3186d4 --- /dev/null +++ b/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs @@ -0,0 +1,53 @@ +#pragma warning error CS8625 + +namespace TUnit.Mocks.Tests; + +public interface INullLiteralService +{ + string Take(string? value); + string Pair(string? first, string? second); + void Notify(string? value); + string NullableNumber(int? value); +} + +public class NullLiteralMatcherTests +{ + [Test] + public async Task Null_And_Default_Literals_Match_Only_Null() + { + var mock = Mock.Of(); + mock.Take(null).Returns("null"); + mock.NullableNumber(default).Returns("null number"); + mock.Notify(default).WasNeverCalled(); + + await Assert.That(mock.Object.Take(null)).IsEqualTo("null"); + await Assert.That(mock.Object.Take("value")).IsEqualTo(""); + await Assert.That(mock.Object.NullableNumber(null)).IsEqualTo("null number"); + await Assert.That(mock.Object.NullableNumber(1)).IsEqualTo(""); + mock.Object.Notify(null); + mock.Object.Notify("value"); + + mock.Take(default).WasCalled(Times.Once); + mock.NullableNumber(null).WasCalled(Times.Once); + mock.Notify(null).WasCalled(Times.Once); + } + + [Test] + public async Task Null_Literals_Combine_With_Predicates_And_Exact_Values() + { + var mock = Mock.Of(); + mock.Pair(null, value => value == "second").Returns("first null"); + mock.Pair(value => value == "first", default).Returns("second null"); + mock.Pair(null, "exact").Returns("exact"); + mock.Pair(null, null).Returns("both null"); + + await Assert.That(mock.Object.Pair(null, "second")).IsEqualTo("first null"); + await Assert.That(mock.Object.Pair("first", null)).IsEqualTo("second null"); + await Assert.That(mock.Object.Pair(null, "exact")).IsEqualTo("exact"); + await Assert.That(mock.Object.Pair(null, null)).IsEqualTo("both null"); + await Assert.That(mock.Object.Pair("other", "second")).IsEqualTo(""); + mock.Pair(null, value => value == "second").WasCalled(Times.Once); + mock.Pair(value => value == "first", default).WasCalled(Times.Once); + mock.Pair(default, default).WasCalled(Times.Once); + } +} From 4e1c9def771d767bac541da1b6323fe3ec2c98b5 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:42:04 +0000 Subject: [PATCH 2/5] test(mocks): enforce nullable regression warnings for #7306 --- tests/TUnit.Mocks.Tests/Issue5425Tests.cs | 2 +- tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs | 2 -- tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/TUnit.Mocks.Tests/Issue5425Tests.cs b/tests/TUnit.Mocks.Tests/Issue5425Tests.cs index 148cc5873be..c17c0999c3f 100644 --- a/tests/TUnit.Mocks.Tests/Issue5425Tests.cs +++ b/tests/TUnit.Mocks.Tests/Issue5425Tests.cs @@ -1,6 +1,6 @@ #nullable enable -// The project file promotes the nullability warnings that #5424 / #5425 produced into errors so any +// The project WarningsAsErrors setting promotes the nullability warnings that #5424 / #5425 produced into errors so any // regression in the source generator (where the generated mock loses nullability // information from the source event) breaks this project's build instead of // silently emitting warnings. diff --git a/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs b/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs index 22b9c3186d4..d4d91139df4 100644 --- a/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs +++ b/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs @@ -1,5 +1,3 @@ -#pragma warning error CS8625 - namespace TUnit.Mocks.Tests; public interface INullLiteralService diff --git a/tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj b/tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj index 3f5aa87fc66..88ae01245d6 100644 --- a/tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj +++ b/tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj @@ -9,6 +9,8 @@ + + $(WarningsAsErrors);CS8625;CS8604;CS8612;CS8613;CS8614;CS8615 true $(WarningsAsErrors);CS8604;CS8612;CS8613;CS8614;CS8615;CS8634 ..\..\eng\strongname.snk From d4b3be7ecb6fbc83fd87a233d0e19a14186ff948 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:45:23 +0000 Subject: [PATCH 3/5] test(mocks): pin non-nullable default matcher behavior (#7306) --- .../NullLiteralMatcherTests.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs b/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs index d4d91139df4..84515cd50de 100644 --- a/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs +++ b/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs @@ -6,10 +6,31 @@ public interface INullLiteralService string Pair(string? first, string? second); void Notify(string? value); string NullableNumber(int? value); + string Number(int value); } public class NullLiteralMatcherTests { + [Test] + public async Task Default_Literal_For_NonNullable_Number_Is_A_Null_Predicate() + { + var mock = Mock.Of(); + // An untyped default selects the nullable predicate overload. Null cannot + // match an int; use a typed default to request the exact value zero. + mock.Number(default).Returns("null predicate"); + + await Assert.That(mock.Object.Number(0)).IsEqualTo(""); + mock.Number(default).WasNeverCalled(); + + mock.Number(default(int)).Returns("zero"); + + await Assert.That(mock.Object.Number(0)).IsEqualTo("zero"); + await Assert.That(mock.Object.Number(1)).IsEqualTo(""); + + mock.Number(default(int)).WasCalled(Times.Exactly(2)); + mock.Number(default).WasNeverCalled(); + } + [Test] public async Task Null_And_Default_Literals_Match_Only_Null() { From 4c17967f3895861cc93c7d40bb6f0cea98e3392a Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:42:05 +0000 Subject: [PATCH 4/5] test(mocks): reconcile nullable constraint coverage for #7306 --- .../Generic_Constraints_Preserve_Nullability.verified.txt | 4 ++-- tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Constraints_Preserve_Nullability.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Constraints_Preserve_Nullability.verified.txt index a9418dba928..4740092d070 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Constraints_Preserve_Nullability.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Constraints_Preserve_Nullability.verified.txt @@ -128,9 +128,9 @@ namespace TUnit.Mocks.Generated return new IService_Get_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Get", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } - public static IService_Get_M0_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func key) where T : class? + public static IService_Get_M0_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func? key) where T : class? { - global::TUnit.Mocks.Arguments.Arg __fa_key = key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IService_Get_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Get", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj b/tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj index 88ae01245d6..c6bed4eb7c8 100644 --- a/tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj +++ b/tests/TUnit.Mocks.Tests/TUnit.Mocks.Tests.csproj @@ -10,9 +10,8 @@ - $(WarningsAsErrors);CS8625;CS8604;CS8612;CS8613;CS8614;CS8615 + $(WarningsAsErrors);CS8625;CS8604;CS8612;CS8613;CS8614;CS8615;CS8634 true - $(WarningsAsErrors);CS8604;CS8612;CS8613;CS8614;CS8615;CS8634 ..\..\eng\strongname.snk From 165d4ba6430ba229956a6a3c96a6fbd7f219f478 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:17:12 +0000 Subject: [PATCH 5/5] fix(mocks): match type defaults for null predicates (#7306) --- .../Builders/MockMembersBuilder.cs | 5 +- ...losed_Generic_Usages_Snapshot.verified.txt | 4 +- ...thod_Type_Parameters_Snapshot.verified.txt | 96 +++++++++---------- ...s_Back_To_Generated_Namespace.verified.txt | 2 +- ..._Returning_Task_And_ValueTask.verified.txt | 6 +- ...er_Static_Extension_Discovery.verified.txt | 2 +- ...straints_Preserve_Nullability.verified.txt | 2 +- ...Interface_Extension_Discovery.verified.txt | 4 +- ...face_With_Class_Type_Argument.verified.txt | 2 +- ...le_Non_Builtin_Type_Arguments.verified.txt | 2 +- ...ested_Namespace_Type_Argument.verified.txt | 2 +- ...rectly_Inheriting_IEnumerable.verified.txt | 2 +- ...entUI_Shape_Nullable_Warnings.verified.txt | 16 ++-- ...nheriting_Multiple_Interfaces.verified.txt | 2 +- .../Interface_With_Async_Methods.verified.txt | 6 +- ...ultable_Generic_Async_Results.verified.txt | 4 +- .../Interface_With_Events.verified.txt | 2 +- ..._Constraints_On_Explicit_Impl.verified.txt | 2 +- ...nterface_With_Generic_Methods.verified.txt | 6 +- ...ace_With_Keyword_Member_Names.verified.txt | 10 +- ..._With_Keyword_Parameter_Names.verified.txt | 10 +- .../Interface_With_Mixed_Members.verified.txt | 4 +- ..._RefStruct_Out_Ref_Parameters.verified.txt | 2 +- ...ble_Reference_Type_Parameters.verified.txt | 36 +++---- ...terface_With_Obsolete_Members.verified.txt | 12 +-- ...rface_With_Out_Ref_Parameters.verified.txt | 2 +- ...rface_With_Overloaded_Methods.verified.txt | 36 +++---- ...e_With_Params_Array_Parameter.verified.txt | 14 +-- ...stract_Transitive_Return_Type.verified.txt | 2 +- ...ters_Named_Like_Numeric_Types.verified.txt | 6 +- ..._With_Secondary_Setup_Surface.verified.txt | 2 +- .../Multi_Method_Interface.verified.txt | 16 ++-- ...embers_From_External_Assembly.verified.txt | 2 +- ...With_Internal_Signature_Types.verified.txt | 2 +- ...c_Constrained_Virtual_Methods.verified.txt | 6 +- ...lsOf_GetHashCodeOf_ToStringOf.verified.txt | 4 +- ...ple_Interface_With_One_Method.verified.txt | 2 +- ...ion_Discovery_Without_Mock_Of.verified.txt | 2 +- ..._Mocked_Regularly_And_Wrapped.verified.txt | 8 +- ...c_Constrained_Virtual_Methods.verified.txt | 4 +- .../NullLiteralMatcherTests.cs | 32 ++++--- 41 files changed, 196 insertions(+), 185 deletions(-) diff --git a/src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs b/src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs index 596653ee146..8453f5cf598 100644 --- a/src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs +++ b/src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs @@ -1300,13 +1300,14 @@ private static void EmitSingleFuncOverload(CodeWriter writer, MockMemberModel me EmitOutParamDefaults(writer, method); - // A null predicate (including null/default literals) means an exact-null matcher. + // A null predicate (including null/default literals) matches the parameter type’s default. + // This also handles value-type instantiations of unconstrained generic parameters. // Keep non-null predicates on the existing implicit-conversion path. foreach (var idx in funcIndices.OrderBy(i => i)) { var p = method.Parameters[idx]; var rawName = p.Name.StartsWith("@", StringComparison.Ordinal) ? p.Name[1..] : p.Name; - writer.AppendLine($"global::TUnit.Mocks.Arguments.Arg<{p.FullyQualifiedType}> __fa_{rawName} = {p.Name} is null ? global::TUnit.Mocks.Arguments.Arg.IsNull<{p.FullyQualifiedType}>() : (global::TUnit.Mocks.Arguments.Arg<{p.FullyQualifiedType}>){p.Name};"); + writer.AppendLine($"global::TUnit.Mocks.Arguments.Arg<{p.FullyQualifiedType}> __fa_{rawName} = {p.Name} is null ? global::TUnit.Mocks.Arguments.Arg.Is<{p.FullyQualifiedType}>(default({p.FullyQualifiedType})!) : (global::TUnit.Mocks.Arguments.Arg<{p.FullyQualifiedType}>){p.Name};"); } // Build matchers array diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Closed_Generic_Usages_Snapshot.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Closed_Generic_Usages_Snapshot.verified.txt index f743fd3a77b..ee558f7d905 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Closed_Generic_Usages_Snapshot.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Closed_Generic_Usages_Snapshot.verified.txt @@ -129,7 +129,7 @@ namespace TUnit.Mocks.Generated public static TestNamespace_IPair_TKey_TValue__Get_M0_MockCall Get(this global::TUnit.Mocks.Mock> mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TKey)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new TestNamespace_IPair_TKey_TValue__Get_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Get", matchers); } @@ -331,7 +331,7 @@ namespace TUnit.Mocks.Generated public static TestNamespace_IRepository_T__Find_M0_MockCall Find(this global::TUnit.Mocks.Mock> mock, global::System.Func? id) { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new TestNamespace_IRepository_T__Find_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Find", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Colliding_Method_Type_Parameters_Snapshot.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Colliding_Method_Type_Parameters_Snapshot.verified.txt index 2563dd30f26..a3b2b757f29 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Colliding_Method_Type_Parameters_Snapshot.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Colliding_Method_Type_Parameters_Snapshot.verified.txt @@ -77,7 +77,7 @@ namespace TestNamespace public TestNamespace_IConstrained_T__Select_M0_MockCall Select(global::System.Func? value) where TOther : TMethod { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IConstrained_T__Select_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Select", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -161,7 +161,7 @@ namespace TUnit.Mocks.Generated public TestNamespace_IConstrained_T__Select_M0_MockCall Select(global::System.Func? value) where TOther : TMethod { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IConstrained_T__Select_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Select", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -176,7 +176,7 @@ namespace TUnit.Mocks.Generated public TestNamespace_IConstrained_T__Select_M0_MockCall Select(global::System.Func? value) where TOther : TMethod { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IConstrained_T__Select_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Select", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -315,7 +315,7 @@ namespace TestNamespace public TestNamespace_IMethodNamed_T__TMethod_M0_MockCall TMethod(global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IMethodNamed_T__TMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TMethod", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -399,7 +399,7 @@ namespace TUnit.Mocks.Generated public TestNamespace_IMethodNamed_T__TMethod_M0_MockCall TMethod(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IMethodNamed_T__TMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TMethod", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -414,7 +414,7 @@ namespace TUnit.Mocks.Generated public TestNamespace_IMethodNamed_T__TMethod_M0_MockCall TMethod(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IMethodNamed_T__TMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TMethod", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -543,7 +543,7 @@ namespace TestNamespace public TestNamespace_IOutbox_T__Invoke_M1_MockCall Invoke(global::System.Func? message) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object)!) : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new TestNamespace_IOutbox_T__Invoke_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -634,7 +634,7 @@ namespace TUnit.Mocks.Generated public TestNamespace_IOutbox_T__Invoke_M1_MockCall Invoke(global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object)!) : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new TestNamespace_IOutbox_T__Invoke_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -649,7 +649,7 @@ namespace TUnit.Mocks.Generated public TestNamespace_IOutbox_T__Invoke_M1_MockCall Invoke(global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object)!) : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new TestNamespace_IOutbox_T__Invoke_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -794,7 +794,7 @@ namespace TestNamespace public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::TUnit.Mocks.Arguments.Arg value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)TMethod; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -802,7 +802,7 @@ namespace TestNamespace public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::TUnit.Mocks.Arguments.Arg TMethod, global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -810,8 +810,8 @@ namespace TestNamespace public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -895,22 +895,22 @@ namespace TUnit.Mocks.Generated public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::TUnit.Mocks.Arguments.Arg value) { - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)TMethod; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::TUnit.Mocks.Arguments.Arg TMethod, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -925,22 +925,22 @@ namespace TUnit.Mocks.Generated public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::TUnit.Mocks.Arguments.Arg value) { - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)TMethod; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::TUnit.Mocks.Arguments.Arg TMethod, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_IParameterNamed_T__Invoke_M0_MockCall Invoke(global::System.Func? TMethod, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)TMethod; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_TMethod = TMethod is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)TMethod; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_TMethod.Matcher, __fa_value.Matcher }; return new TestNamespace_IParameterNamed_T__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1072,7 +1072,7 @@ namespace TestNamespace public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::TUnit.Mocks.Arguments.Arg value) where TKey : notnull { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TKey)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1080,7 +1080,7 @@ namespace TestNamespace public TestNamespace_IStore_T__Put_M0_MockCall Put(global::TUnit.Mocks.Arguments.Arg key, global::System.Func? value) where TKey : notnull { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1088,8 +1088,8 @@ namespace TestNamespace public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::System.Func? value) where TKey : notnull { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TKey)!) : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1106,7 +1106,7 @@ namespace TestNamespace public TestNamespace_IStore_T__Convert_M1_MockCall Convert(global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IStore_T__Convert_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Convert", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1195,22 +1195,22 @@ namespace TUnit.Mocks.Generated public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::TUnit.Mocks.Arguments.Arg value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TKey)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_IStore_T__Put_M0_MockCall Put(global::TUnit.Mocks.Arguments.Arg key, global::System.Func? value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::System.Func? value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TKey)!) : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1225,22 +1225,22 @@ namespace TUnit.Mocks.Generated public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::TUnit.Mocks.Arguments.Arg value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TKey)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_IStore_T__Put_M0_MockCall Put(global::TUnit.Mocks.Arguments.Arg key, global::System.Func? value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_IStore_T__Put_M0_MockCall Put(global::System.Func? key, global::System.Func? value) where TKey : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TKey)!) : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, __fa_value.Matcher }; return new TestNamespace_IStore_T__Put_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Put", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1256,7 +1256,7 @@ namespace TUnit.Mocks.Generated public TestNamespace_IStore_T__Convert_M1_MockCall Convert(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IStore_T__Convert_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Convert", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1271,7 +1271,7 @@ namespace TUnit.Mocks.Generated public TestNamespace_IStore_T__Convert_M1_MockCall Convert(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new TestNamespace_IStore_T__Convert_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Convert", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1431,7 +1431,7 @@ namespace TestNamespace public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::TUnit.Mocks.Arguments.Arg second) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)first; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1439,7 +1439,7 @@ namespace TestNamespace public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::TUnit.Mocks.Arguments.Arg first, global::System.Func? second) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1447,8 +1447,8 @@ namespace TestNamespace public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::System.Func? second) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; - global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)first; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1532,22 +1532,22 @@ namespace TUnit.Mocks.Generated public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::TUnit.Mocks.Arguments.Arg second) { - global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)first; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::TUnit.Mocks.Arguments.Arg first, global::System.Func? second) { - global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::System.Func? second) { - global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; - global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)first; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -1562,22 +1562,22 @@ namespace TUnit.Mocks.Generated public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::TUnit.Mocks.Arguments.Arg second) { - global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)first; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::TUnit.Mocks.Arguments.Arg first, global::System.Func? second) { - global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public TestNamespace_ITaken_T__Use_M0_MockCall Use(global::System.Func? first, global::System.Func? second) { - global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)first; - global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)second; + global::TUnit.Mocks.Arguments.Arg __fa_first = first is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod2)!) : (global::TUnit.Mocks.Arguments.Arg)first; + global::TUnit.Mocks.Arguments.Arg __fa_second = second is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TMethod)!) : (global::TUnit.Mocks.Arguments.Arg)second; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_first.Matcher, __fa_second.Matcher }; return new TestNamespace_ITaken_T__Use_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Use", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Conflict_With_Existing_Type_Falls_Back_To_Generated_Namespace.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Conflict_With_Existing_Type_Falls_Back_To_Generated_Namespace.verified.txt index 7239e63ff5e..cbe0512812c 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Conflict_With_Existing_Type_Falls_Back_To_Generated_Namespace.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Conflict_With_Existing_Type_Falls_Back_To_Generated_Namespace.verified.txt @@ -95,7 +95,7 @@ namespace TUnit.Mocks.Generated public static MyApp_IGreeter_Greet_M0_MockCall Greet(this global::TUnit.Mocks.Mock mock, global::System.Func? name) { - global::TUnit.Mocks.Arguments.Arg __fa_name = name is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)name; + global::TUnit.Mocks.Arguments.Arg __fa_name = name is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)name; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_name.Matcher }; return new MyApp_IGreeter_Greet_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Greet", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Delegates_Returning_Task_And_ValueTask.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Delegates_Returning_Task_And_ValueTask.verified.txt index 52830f7bdfa..51df504ff59 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Delegates_Returning_Task_And_ValueTask.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Delegates_Returning_Task_And_ValueTask.verified.txt @@ -182,7 +182,7 @@ namespace TUnit.Mocks.Generated public static System_Func_int_System_Threading_Tasks_Task__Invoke_M0_MockCall Invoke(this global::TUnit.Mocks.Mock> mock, global::System.Func? arg) { - global::TUnit.Mocks.Arguments.Arg __fa_arg = arg is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg; + global::TUnit.Mocks.Arguments.Arg __fa_arg = arg is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)arg; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_arg.Matcher }; return new System_Func_int_System_Threading_Tasks_Task__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers); } @@ -331,7 +331,7 @@ namespace TUnit.Mocks.Generated public static System_Func_int_System_Threading_Tasks_Task_int__Invoke_M0_MockCall Invoke(this global::TUnit.Mocks.Mock>> mock, global::System.Func? arg) { - global::TUnit.Mocks.Arguments.Arg __fa_arg = arg is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg; + global::TUnit.Mocks.Arguments.Arg __fa_arg = arg is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)arg; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_arg.Matcher }; return new System_Func_int_System_Threading_Tasks_Task_int__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers); } @@ -535,7 +535,7 @@ namespace TUnit.Mocks.Generated public static System_Func_string_System_Threading_Tasks_ValueTask_string__Invoke_M0_MockCall Invoke(this global::TUnit.Mocks.Mock>> mock, global::System.Func? arg) { - global::TUnit.Mocks.Arguments.Arg __fa_arg = arg is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg; + global::TUnit.Mocks.Arguments.Arg __fa_arg = arg is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_arg.Matcher }; return new System_Func_string_System_Threading_Tasks_ValueTask_string__Invoke_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Invoke", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/External_Interface_With_Indexer_Static_Extension_Discovery.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/External_Interface_With_Indexer_Static_Extension_Discovery.verified.txt index dad30222283..118e3e16232 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/External_Interface_With_Indexer_Static_Extension_Discovery.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/External_Interface_With_Indexer_Static_Extension_Discovery.verified.txt @@ -103,7 +103,7 @@ namespace TUnit.Mocks.Generated public static Microsoft_Extensions_Configuration_IConfiguration_GetSectionValue_M0_MockCall GetSectionValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new Microsoft_Extensions_Configuration_IConfiguration_GetSectionValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetSectionValue", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Constraints_Preserve_Nullability.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Constraints_Preserve_Nullability.verified.txt index 4740092d070..7fe81a758f7 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Constraints_Preserve_Nullability.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Constraints_Preserve_Nullability.verified.txt @@ -130,7 +130,7 @@ namespace TUnit.Mocks.Generated public static IService_Get_M0_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func? key) where T : class? { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IService_Get_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Get", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt index d157742a9cb..660331fa996 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_Extension_Discovery.verified.txt @@ -93,7 +93,7 @@ namespace TUnit.Mocks.Generated public static IRepository_T__GetById_M0_MockCall GetById(this global::TUnit.Mocks.Mock> mock, global::System.Func? id) { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IRepository_T__GetById_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetById", matchers); } @@ -106,7 +106,7 @@ namespace TUnit.Mocks.Generated public static IRepository_T__Save_M1_MockCall Save(this global::TUnit.Mocks.Mock> mock, global::System.Func? entity) { - global::TUnit.Mocks.Arguments.Arg __fa_entity = entity is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)entity; + global::TUnit.Mocks.Arguments.Arg __fa_entity = entity is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)entity; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_entity.Matcher }; return new IRepository_T__Save_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Save", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt index 41d09e61fbb..1d71364fc0d 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Class_Type_Argument.verified.txt @@ -99,7 +99,7 @@ namespace TUnit.Mocks.Generated public static Sandbox_IFoo_T__Process_M1_MockCall Process(this global::TUnit.Mocks.Mock> mock, global::System.Func? item) { - global::TUnit.Mocks.Arguments.Arg __fa_item = item is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)item; + global::TUnit.Mocks.Arguments.Arg __fa_item = item is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)item; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_item.Matcher }; return new Sandbox_IFoo_T__Process_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Process", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt index 400ff6fb791..5f6fb678792 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Multiple_Non_Builtin_Type_Arguments.verified.txt @@ -89,7 +89,7 @@ namespace TUnit.Mocks.Generated public static Sandbox_IMapper_TIn_TOut__Map_M0_MockCall Map(this global::TUnit.Mocks.Mock> mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TIn)!) : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new Sandbox_IMapper_TIn_TOut__Map_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Map", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt index fb12dc57a41..4b51a73dcce 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Generic_Interface_With_Nested_Namespace_Type_Argument.verified.txt @@ -105,7 +105,7 @@ namespace TUnit.Mocks.Generated public static Sandbox_IService_T__Apply_M1_MockCall Apply(this global::TUnit.Mocks.Mock> mock, global::System.Func? config) { - global::TUnit.Mocks.Arguments.Arg __fa_config = config is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)config; + global::TUnit.Mocks.Arguments.Arg __fa_config = config is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)config; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_config.Matcher }; return new Sandbox_IService_T__Apply_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Apply", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt index b77f84113da..e5731dc259a 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Directly_Inheriting_IEnumerable.verified.txt @@ -110,7 +110,7 @@ namespace TUnit.Mocks.Generated public static ICustomCollection_Add_M1_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? item) { - global::TUnit.Mocks.Arguments.Arg __fa_item = item is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)item; + global::TUnit.Mocks.Arguments.Arg __fa_item = item is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)item; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_item.Matcher }; return new ICustomCollection_Add_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Add", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt index c428b2e6a5f..84447f00e5d 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_FluentUI_Shape_Nullable_Warnings.verified.txt @@ -406,22 +406,22 @@ namespace TUnit.Mocks.Generated public static IDialogService_UpdateDialogAsync_M0_MockCall UpdateDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id, global::TUnit.Mocks.Arguments.Arg> parameters) where TData : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher, parameters.Matcher }; return new IDialogService_UpdateDialogAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "UpdateDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public static IDialogService_UpdateDialogAsync_M0_MockCall UpdateDialogAsync(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg id, global::System.Func, bool>? parameters) where TData : class { - global::TUnit.Mocks.Arguments.Arg> __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.IsNull>() : (global::TUnit.Mocks.Arguments.Arg>)parameters; + global::TUnit.Mocks.Arguments.Arg> __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.Is>(default(global::DialogParameters)!) : (global::TUnit.Mocks.Arguments.Arg>)parameters; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { id.Matcher, __fa_parameters.Matcher }; return new IDialogService_UpdateDialogAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "UpdateDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public static IDialogService_UpdateDialogAsync_M0_MockCall UpdateDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id, global::System.Func, bool>? parameters) where TData : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; - global::TUnit.Mocks.Arguments.Arg> __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.IsNull>() : (global::TUnit.Mocks.Arguments.Arg>)parameters; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg> __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.Is>(default(global::DialogParameters)!) : (global::TUnit.Mocks.Arguments.Arg>)parameters; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher, __fa_parameters.Matcher }; return new IDialogService_UpdateDialogAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "UpdateDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -434,22 +434,22 @@ namespace TUnit.Mocks.Generated public static IDialogService_ShowDialogAsync_M1_MockCall ShowDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? data, global::TUnit.Mocks.Arguments.Arg parameters) where TDialog : global::IDialogContentComponent { - global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object)!) : (global::TUnit.Mocks.Arguments.Arg)data; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher, parameters.Matcher }; return new IDialogService_ShowDialogAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public static IDialogService_ShowDialogAsync_M1_MockCall ShowDialogAsync(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg data, global::System.Func? parameters) where TDialog : global::IDialogContentComponent { - global::TUnit.Mocks.Arguments.Arg __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)parameters; + global::TUnit.Mocks.Arguments.Arg __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(global::DialogParameters)!) : (global::TUnit.Mocks.Arguments.Arg)parameters; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { data.Matcher, __fa_parameters.Matcher }; return new IDialogService_ShowDialogAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } public static IDialogService_ShowDialogAsync_M1_MockCall ShowDialogAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? data, global::System.Func? parameters) where TDialog : global::IDialogContentComponent { - global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; - global::TUnit.Mocks.Arguments.Arg __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)parameters; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object)!) : (global::TUnit.Mocks.Arguments.Arg)data; + global::TUnit.Mocks.Arguments.Arg __fa_parameters = parameters is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(global::DialogParameters)!) : (global::TUnit.Mocks.Arguments.Arg)parameters; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher, __fa_parameters.Matcher }; return new IDialogService_ShowDialogAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowDialogAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt index 05b92e20a5a..aa87c9721bf 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt @@ -121,7 +121,7 @@ namespace TUnit.Mocks.Generated public static IReadWriter_Write_M2_MockCall Write(this global::TUnit.Mocks.Mock mock, global::System.Func? data) { - global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)data; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher }; return new IReadWriter_Write_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Write", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt index 65e736d4bda..39c22b9d688 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt @@ -162,7 +162,7 @@ namespace TUnit.Mocks.Generated public static IAsyncService_GetValueAsync_M0_MockCall GetValueAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IAsyncService_GetValueAsync_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetValueAsync", matchers); } @@ -181,7 +181,7 @@ namespace TUnit.Mocks.Generated public static IAsyncService_ComputeAsync_M2_MockCall ComputeAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new IAsyncService_ComputeAsync_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "ComputeAsync", matchers); } @@ -194,7 +194,7 @@ namespace TUnit.Mocks.Generated public static IAsyncService_InitializeAsync_M3_MockCall InitializeAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? ct) { - global::TUnit.Mocks.Arguments.Arg __fa_ct = ct is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)ct; + global::TUnit.Mocks.Arguments.Arg __fa_ct = ct is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(global::System.Threading.CancellationToken)!) : (global::TUnit.Mocks.Arguments.Arg)ct; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_ct.Matcher }; return new IAsyncService_InitializeAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "InitializeAsync", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Enum_And_Defaultable_Generic_Async_Results.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Enum_And_Defaultable_Generic_Async_Results.verified.txt index c6572adc44f..742d5de13e7 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Enum_And_Defaultable_Generic_Async_Results.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Enum_And_Defaultable_Generic_Async_Results.verified.txt @@ -174,7 +174,7 @@ namespace TUnit.Mocks.Generated public static IEnumAndGenericService_FindAsync_M2_MockCall FindAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id) { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IEnumAndGenericService_FindAsync_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "FindAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -187,7 +187,7 @@ namespace TUnit.Mocks.Generated public static IEnumAndGenericService_FindStructAsync_M3_MockCall FindStructAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id) where T : struct { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IEnumAndGenericService_FindStructAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "FindStructAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt index fdedb853836..b508e33e41b 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Events.verified.txt @@ -149,7 +149,7 @@ namespace TUnit.Mocks.Generated public static INotifier_Notify_M0_MockCall Notify(this global::TUnit.Mocks.Mock mock, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new INotifier_Notify_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Notify", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt index 986814e0a1f..0c9609694ba 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Method_Constraints_On_Explicit_Impl.verified.txt @@ -124,7 +124,7 @@ namespace TUnit.Mocks.Generated public static IConstrained_GetNotnull_M0_MockCall GetNotnull(this global::TUnit.Mocks.Mock mock, global::System.Func? key) where T : notnull { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IConstrained_GetNotnull_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetNotnull", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt index 6b1baf8adef..c1ff07baffb 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Generic_Methods.verified.txt @@ -106,7 +106,7 @@ namespace TUnit.Mocks.Generated public static IRepository_GetById_M0_MockCall GetById(this global::TUnit.Mocks.Mock mock, global::System.Func? id) where T : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IRepository_GetById_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetById", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -119,7 +119,7 @@ namespace TUnit.Mocks.Generated public static IRepository_Save_M1_MockCall Save(this global::TUnit.Mocks.Mock mock, global::System.Func? entity) where T : class, new() { - global::TUnit.Mocks.Arguments.Arg __fa_entity = entity is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)entity; + global::TUnit.Mocks.Arguments.Arg __fa_entity = entity is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)entity; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_entity.Matcher }; return new IRepository_Save_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Save", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -132,7 +132,7 @@ namespace TUnit.Mocks.Generated public static IRepository_Transform_M2_MockCall Transform(this global::TUnit.Mocks.Mock mock, global::System.Func? input) where TInput : notnull where TResult : struct { - global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TInput)!) : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new IRepository_Transform_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Transform", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt index d2ecf63f0ed..3b937d5f352 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Member_Names.verified.txt @@ -119,7 +119,7 @@ namespace TUnit.Mocks.Generated public static IEscapedNames_event_M2_MockCall @event(this global::TUnit.Mocks.Mock mock, global::System.Func? @params) { - global::TUnit.Mocks.Arguments.Arg __fa_params = @params is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@params; + global::TUnit.Mocks.Arguments.Arg __fa_params = @params is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)@params; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_params.Matcher }; return new IEscapedNames_event_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "event", matchers); } @@ -132,22 +132,22 @@ namespace TUnit.Mocks.Generated public static IEscapedNames_namespace_M3_MockCall @namespace(this global::TUnit.Mocks.Mock mock, global::System.Func? @new, global::TUnit.Mocks.Arguments.Arg @static) { - global::TUnit.Mocks.Arguments.Arg __fa_new = @new is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@new; + global::TUnit.Mocks.Arguments.Arg __fa_new = @new is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)@new; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_new.Matcher, @static.Matcher }; return new IEscapedNames_namespace_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "namespace", matchers); } public static IEscapedNames_namespace_M3_MockCall @namespace(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg @new, global::System.Func? @static) { - global::TUnit.Mocks.Arguments.Arg __fa_static = @static is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@static; + global::TUnit.Mocks.Arguments.Arg __fa_static = @static is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)@static; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { @new.Matcher, __fa_static.Matcher }; return new IEscapedNames_namespace_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "namespace", matchers); } public static IEscapedNames_namespace_M3_MockCall @namespace(this global::TUnit.Mocks.Mock mock, global::System.Func? @new, global::System.Func? @static) { - global::TUnit.Mocks.Arguments.Arg __fa_new = @new is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@new; - global::TUnit.Mocks.Arguments.Arg __fa_static = @static is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@static; + global::TUnit.Mocks.Arguments.Arg __fa_new = @new is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)@new; + global::TUnit.Mocks.Arguments.Arg __fa_static = @static is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)@static; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_new.Matcher, __fa_static.Matcher }; return new IEscapedNames_namespace_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "namespace", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt index 2d2666e3c3f..940b883e5db 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Keyword_Parameter_Names.verified.txt @@ -99,7 +99,7 @@ namespace TUnit.Mocks.Generated public static ITest_Test_M0_MockCall Test(this global::TUnit.Mocks.Mock mock, global::System.Func? @event) { - global::TUnit.Mocks.Arguments.Arg __fa_event = @event is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@event; + global::TUnit.Mocks.Arguments.Arg __fa_event = @event is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)@event; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_event.Matcher }; return new ITest_Test_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Test", matchers); } @@ -112,22 +112,22 @@ namespace TUnit.Mocks.Generated public static ITest_Get_M1_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func? @class, global::TUnit.Mocks.Arguments.Arg @return) { - global::TUnit.Mocks.Arguments.Arg __fa_class = @class is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@class; + global::TUnit.Mocks.Arguments.Arg __fa_class = @class is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)@class; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_class.Matcher, @return.Matcher }; return new ITest_Get_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Get", matchers); } public static ITest_Get_M1_MockCall Get(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg @class, global::System.Func? @return) { - global::TUnit.Mocks.Arguments.Arg __fa_return = @return is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@return; + global::TUnit.Mocks.Arguments.Arg __fa_return = @return is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)@return; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { @class.Matcher, __fa_return.Matcher }; return new ITest_Get_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Get", matchers); } public static ITest_Get_M1_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func? @class, global::System.Func? @return) { - global::TUnit.Mocks.Arguments.Arg __fa_class = @class is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@class; - global::TUnit.Mocks.Arguments.Arg __fa_return = @return is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)@return; + global::TUnit.Mocks.Arguments.Arg __fa_class = @class is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)@class; + global::TUnit.Mocks.Arguments.Arg __fa_return = @return is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)@return; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_class.Matcher, __fa_return.Matcher }; return new ITest_Get_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Get", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt index 69174dcbf3a..c3c12c7b510 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Mixed_Members.verified.txt @@ -184,7 +184,7 @@ namespace TUnit.Mocks.Generated public static IService_GetAsync_M3_MockCall GetAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? id) { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new IService_GetAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "GetAsync", matchers); } @@ -197,7 +197,7 @@ namespace TUnit.Mocks.Generated public static IService_Process_M4_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? data) { - global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)data; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher }; return new IService_Process_M4_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 4, "Process", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_NonSpan_RefStruct_Out_Ref_Parameters.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_NonSpan_RefStruct_Out_Ref_Parameters.verified.txt index 175cb485913..daa7c217d2b 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_NonSpan_RefStruct_Out_Ref_Parameters.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_NonSpan_RefStruct_Out_Ref_Parameters.verified.txt @@ -122,7 +122,7 @@ namespace TUnit.Mocks.Generated public static Sandbox_ICursorParser_TryRead_M0_MockCall TryRead(this global::TUnit.Mocks.Mock mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new Sandbox_ICursorParser_TryRead_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TryRead", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt index 2641389a7dd..d3a48707044 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Nullable_Reference_Type_Parameters.verified.txt @@ -137,7 +137,7 @@ namespace TUnit.Mocks.Generated public static IFoo_Bar_M0_MockCall Bar(this global::TUnit.Mocks.Mock mock, global::System.Func? baz) { - global::TUnit.Mocks.Arguments.Arg __fa_baz = baz is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)baz; + global::TUnit.Mocks.Arguments.Arg __fa_baz = baz is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object?)!) : (global::TUnit.Mocks.Arguments.Arg)baz; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_baz.Matcher }; return new IFoo_Bar_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Bar", matchers); } @@ -150,22 +150,22 @@ namespace TUnit.Mocks.Generated public static IFoo_GetValue_M1_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key, global::TUnit.Mocks.Arguments.Arg count) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, count.Matcher }; return new IFoo_GetValue_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "GetValue", matchers); } public static IFoo_GetValue_M1_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg key, global::System.Func? count) { - global::TUnit.Mocks.Arguments.Arg __fa_count = count is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)count; + global::TUnit.Mocks.Arguments.Arg __fa_count = count is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)count; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { key.Matcher, __fa_count.Matcher }; return new IFoo_GetValue_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "GetValue", matchers); } public static IFoo_GetValue_M1_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key, global::System.Func? count) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; - global::TUnit.Mocks.Arguments.Arg __fa_count = count is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)count; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_count = count is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)count; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher, __fa_count.Matcher }; return new IFoo_GetValue_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "GetValue", matchers); } @@ -185,54 +185,54 @@ namespace TUnit.Mocks.Generated public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? nonNull, global::TUnit.Mocks.Arguments.Arg nullable, global::TUnit.Mocks.Arguments.Arg obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nonNull; + global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)nonNull; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_nonNull.Matcher, nullable.Matcher, obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg nonNull, global::System.Func? nullable, global::TUnit.Mocks.Arguments.Arg obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nullable; + global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)nullable; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { nonNull.Matcher, __fa_nullable.Matcher, obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? nonNull, global::System.Func? nullable, global::TUnit.Mocks.Arguments.Arg obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nonNull; - global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nullable; + global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)nonNull; + global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)nullable; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_nonNull.Matcher, __fa_nullable.Matcher, obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg nonNull, global::TUnit.Mocks.Arguments.Arg nullable, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object?)!) : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { nonNull.Matcher, nullable.Matcher, __fa_obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? nonNull, global::TUnit.Mocks.Arguments.Arg nullable, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nonNull; - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; + global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)nonNull; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object?)!) : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_nonNull.Matcher, nullable.Matcher, __fa_obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg nonNull, global::System.Func? nullable, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nullable; - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; + global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)nullable; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object?)!) : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { nonNull.Matcher, __fa_nullable.Matcher, __fa_obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } public static IFoo_Process_M2_MockCall Process(this global::TUnit.Mocks.Mock mock, global::System.Func? nonNull, global::System.Func? nullable, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nonNull; - global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)nullable; - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; + global::TUnit.Mocks.Arguments.Arg __fa_nonNull = nonNull is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)nonNull; + global::TUnit.Mocks.Arguments.Arg __fa_nullable = nullable is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)nullable; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object?)!) : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_nonNull.Matcher, __fa_nullable.Matcher, __fa_obj.Matcher }; return new IFoo_Process_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Process", matchers); } @@ -252,7 +252,7 @@ namespace TUnit.Mocks.Generated public static IFoo_GetAsync_M3_MockCall GetAsync(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IFoo_GetAsync_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "GetAsync", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt index 6848d3c326e..16155bb1ba0 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Obsolete_Members.verified.txt @@ -83,7 +83,7 @@ namespace TUnit.Mocks.Generated public static BaseDialog_Compute_M0_MockCall Compute(this global::TUnit.Mocks.Mock mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new BaseDialog_Compute_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Compute", matchers); } @@ -411,22 +411,22 @@ namespace TUnit.Mocks.Generated public static IDialogService_Show_M0_MockCall Show(this global::TUnit.Mocks.Mock mock, global::System.Func? title, global::TUnit.Mocks.Arguments.Arg message) { - global::TUnit.Mocks.Arguments.Arg __fa_title = title is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)title; + global::TUnit.Mocks.Arguments.Arg __fa_title = title is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)title; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_title.Matcher, message.Matcher }; return new IDialogService_Show_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Show", matchers); } public static IDialogService_Show_M0_MockCall Show(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg title, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { title.Matcher, __fa_message.Matcher }; return new IDialogService_Show_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Show", matchers); } public static IDialogService_Show_M0_MockCall Show(this global::TUnit.Mocks.Mock mock, global::System.Func? title, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_title = title is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)title; - global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; + global::TUnit.Mocks.Arguments.Arg __fa_title = title is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)title; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string?)!) : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_title.Matcher, __fa_message.Matcher }; return new IDialogService_Show_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Show", matchers); } @@ -446,7 +446,7 @@ namespace TUnit.Mocks.Generated public static IDialogService_ShowPanel_M1_MockCall ShowPanel(this global::TUnit.Mocks.Mock mock, global::System.Func? data) where TData : class { - global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)data; + global::TUnit.Mocks.Arguments.Arg __fa_data = data is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TData?)!) : (global::TUnit.Mocks.Arguments.Arg)data; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_data.Matcher }; return new IDialogService_ShowPanel_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "ShowPanel", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt index 5512d520e77..d005bc9101f 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Out_Ref_Parameters.verified.txt @@ -112,7 +112,7 @@ namespace TUnit.Mocks.Generated public static IDictionary_TryGetValue_M0_MockCall TryGetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IDictionary_TryGetValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "TryGetValue", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt index 9f5e59158a8..8924c3c4460 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Overloaded_Methods.verified.txt @@ -110,7 +110,7 @@ namespace TUnit.Mocks.Generated public static IFormatter_Format_M0_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new IFormatter_Format_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Format", matchers); } @@ -123,7 +123,7 @@ namespace TUnit.Mocks.Generated public static IFormatter_Format_M1_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new IFormatter_Format_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Format", matchers); } @@ -136,22 +136,22 @@ namespace TUnit.Mocks.Generated public static IFormatter_Format_M2_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::TUnit.Mocks.Arguments.Arg arg1) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)template; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, arg1.Matcher }; return new IFormatter_Format_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Format", matchers); } public static IFormatter_Format_M2_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::System.Func? arg1) { - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg1; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { template.Matcher, __fa_arg1.Matcher }; return new IFormatter_Format_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Format", matchers); } public static IFormatter_Format_M2_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::System.Func? arg1) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg1; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, __fa_arg1.Matcher }; return new IFormatter_Format_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Format", matchers); } @@ -164,54 +164,54 @@ namespace TUnit.Mocks.Generated public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::TUnit.Mocks.Arguments.Arg arg1, global::TUnit.Mocks.Arguments.Arg arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)template; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, arg1.Matcher, arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::System.Func? arg1, global::TUnit.Mocks.Arguments.Arg arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg1; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { template.Matcher, __fa_arg1.Matcher, arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::System.Func? arg1, global::TUnit.Mocks.Arguments.Arg arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg1; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, __fa_arg1.Matcher, arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::TUnit.Mocks.Arguments.Arg arg1, global::System.Func? arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg2; + global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg2; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { template.Matcher, arg1.Matcher, __fa_arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::TUnit.Mocks.Arguments.Arg arg1, global::System.Func? arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; - global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg2; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg2; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, arg1.Matcher, __fa_arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg template, global::System.Func? arg1, global::System.Func? arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; - global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg2; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg1; + global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg2; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { template.Matcher, __fa_arg1.Matcher, __fa_arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } public static IFormatter_Format_M3_MockCall Format(this global::TUnit.Mocks.Mock mock, global::System.Func? template, global::System.Func? arg1, global::System.Func? arg2) { - global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)template; - global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg1; - global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)arg2; + global::TUnit.Mocks.Arguments.Arg __fa_template = template is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)template; + global::TUnit.Mocks.Arguments.Arg __fa_arg1 = arg1 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg1; + global::TUnit.Mocks.Arguments.Arg __fa_arg2 = arg2 is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)arg2; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_template.Matcher, __fa_arg1.Matcher, __fa_arg2.Matcher }; return new IFormatter_Format_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "Format", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Params_Array_Parameter.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Params_Array_Parameter.verified.txt index 86afd3b5ded..fcaf00629ee 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Params_Array_Parameter.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Params_Array_Parameter.verified.txt @@ -110,7 +110,7 @@ namespace TUnit.Mocks.Generated public static IParamsSink_Sum_M0_MockCall Sum(this global::TUnit.Mocks.Mock mock, global::System.Func? values) { - global::TUnit.Mocks.Arguments.Arg __fa_values = values is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)values; + global::TUnit.Mocks.Arguments.Arg __fa_values = values is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int[])!) : (global::TUnit.Mocks.Arguments.Arg)values; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_values.Matcher }; return new IParamsSink_Sum_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Sum", matchers); } @@ -140,7 +140,7 @@ namespace TUnit.Mocks.Generated public static IParamsSink_Render_M1_MockCall Render(this global::TUnit.Mocks.Mock mock, global::System.Func? args) { - global::TUnit.Mocks.Arguments.Arg __fa_args = args is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)args; + global::TUnit.Mocks.Arguments.Arg __fa_args = args is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object[])!) : (global::TUnit.Mocks.Arguments.Arg)args; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_args.Matcher }; return new IParamsSink_Render_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Render", matchers); } @@ -170,22 +170,22 @@ namespace TUnit.Mocks.Generated public static IParamsSink_Combine_M2_MockCall Combine(this global::TUnit.Mocks.Mock mock, global::System.Func? prefix, global::TUnit.Mocks.Arguments.Arg parts) { - global::TUnit.Mocks.Arguments.Arg __fa_prefix = prefix is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)prefix; + global::TUnit.Mocks.Arguments.Arg __fa_prefix = prefix is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)prefix; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_prefix.Matcher, parts.Matcher }; return new IParamsSink_Combine_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Combine", matchers); } public static IParamsSink_Combine_M2_MockCall Combine(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg prefix, global::System.Func? parts) { - global::TUnit.Mocks.Arguments.Arg __fa_parts = parts is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)parts; + global::TUnit.Mocks.Arguments.Arg __fa_parts = parts is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string[])!) : (global::TUnit.Mocks.Arguments.Arg)parts; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { prefix.Matcher, __fa_parts.Matcher }; return new IParamsSink_Combine_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Combine", matchers); } public static IParamsSink_Combine_M2_MockCall Combine(this global::TUnit.Mocks.Mock mock, global::System.Func? prefix, global::System.Func? parts) { - global::TUnit.Mocks.Arguments.Arg __fa_prefix = prefix is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)prefix; - global::TUnit.Mocks.Arguments.Arg __fa_parts = parts is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)parts; + global::TUnit.Mocks.Arguments.Arg __fa_prefix = prefix is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)prefix; + global::TUnit.Mocks.Arguments.Arg __fa_parts = parts is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string[])!) : (global::TUnit.Mocks.Arguments.Arg)parts; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_prefix.Matcher, __fa_parts.Matcher }; return new IParamsSink_Combine_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Combine", matchers); } @@ -222,7 +222,7 @@ namespace TUnit.Mocks.Generated public static IParamsSink_First_M3_MockCall First(this global::TUnit.Mocks.Mock mock, global::System.Func? items) { - global::TUnit.Mocks.Arguments.Arg __fa_items = items is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)items; + global::TUnit.Mocks.Arguments.Arg __fa_items = items is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T[])!) : (global::TUnit.Mocks.Arguments.Arg)items; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_items.Matcher }; return new IParamsSink_First_M3_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 3, "First", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt index f5398ff62df..9aa76353b92 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Static_Abstract_Transitive_Return_Type.verified.txt @@ -96,7 +96,7 @@ namespace TUnit.Mocks.Generated public static IMyService_GetValue_M0_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new IMyService_GetValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetValue", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Type_Parameters_Named_Like_Numeric_Types.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Type_Parameters_Named_Like_Numeric_Types.verified.txt index 8658851c446..7de3be5cc94 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Type_Parameters_Named_Like_Numeric_Types.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Type_Parameters_Named_Like_Numeric_Types.verified.txt @@ -22,7 +22,7 @@ public sealed class INumericNamed_Int32_Mock : global::TUnit.Mocks.Mock RoundtripAsync(global::System.Func? value) { var mock = this; - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(Int64)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new INumericNamed_Int32__RoundtripAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "RoundtripAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -139,7 +139,7 @@ namespace TUnit.Mocks.Generated public INumericNamed_Int32__RoundtripAsync_M1_MockCall RoundtripAsync(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(Int64)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new INumericNamed_Int32__RoundtripAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "RoundtripAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -154,7 +154,7 @@ namespace TUnit.Mocks.Generated public INumericNamed_Int32__RoundtripAsync_M1_MockCall RoundtripAsync(global::System.Func? value) { - global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)value; + global::TUnit.Mocks.Arguments.Arg __fa_value = value is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(Int64)!) : (global::TUnit.Mocks.Arguments.Arg)value; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_value.Matcher }; return new INumericNamed_Int32__RoundtripAsync_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "RoundtripAsync", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Interface_Mock_With_Secondary_Setup_Surface.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Interface_Mock_With_Secondary_Setup_Surface.verified.txt index 8546055db0c..aaf33e0de68 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Interface_Mock_With_Secondary_Setup_Surface.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Interface_Mock_With_Secondary_Setup_Surface.verified.txt @@ -99,7 +99,7 @@ namespace TUnit.Mocks.Generated public static IMultiLogger_Log_M0_MockCall Log(this global::TUnit.Mocks.Mock mock, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new IMultiLogger_Log_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Log", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt index 9caac3404cf..a2e8b21a3c9 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Multi_Method_Interface.verified.txt @@ -106,22 +106,22 @@ namespace TUnit.Mocks.Generated public static ICalculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::TUnit.Mocks.Arguments.Arg b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)a; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, b.Matcher }; return new ICalculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } public static ICalculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { a.Matcher, __fa_b.Matcher }; return new ICalculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } public static ICalculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; - global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)a; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, __fa_b.Matcher }; return new ICalculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } @@ -141,22 +141,22 @@ namespace TUnit.Mocks.Generated public static ICalculator_Subtract_M1_MockCall Subtract(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::TUnit.Mocks.Arguments.Arg b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)a; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, b.Matcher }; return new ICalculator_Subtract_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Subtract", matchers); } public static ICalculator_Subtract_M1_MockCall Subtract(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { a.Matcher, __fa_b.Matcher }; return new ICalculator_Subtract_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Subtract", matchers); } public static ICalculator_Subtract_M1_MockCall Subtract(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; - global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)a; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, __fa_b.Matcher }; return new ICalculator_Subtract_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Subtract", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt index 2aa63658688..10b860d5bdc 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Internal_Virtual_Members_From_External_Assembly.verified.txt @@ -113,7 +113,7 @@ namespace TUnit.Mocks.Generated public static ExternalLib_ExternalClient_PublicMethod_M0_MockCall PublicMethod(this global::TUnit.Mocks.Mock mock, global::System.Func? input) { - global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new ExternalLib_ExternalClient_PublicMethod_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "PublicMethod", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt index c1c71289a91..6d7e8f54470 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_Filters_Members_With_Internal_Signature_Types.verified.txt @@ -85,7 +85,7 @@ namespace TUnit.Mocks.Generated public static ExternalLib_ServiceClient_GetValue_M0_MockCall GetValue(this global::TUnit.Mocks.Mock mock, global::System.Func? key) { - global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)key; + global::TUnit.Mocks.Arguments.Arg __fa_key = key is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)key; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_key.Matcher }; return new ExternalLib_ServiceClient_GetValue_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetValue", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt index 5b679d8caaf..9dfe3b0f9aa 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Partial_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt @@ -105,7 +105,7 @@ namespace TUnit.Mocks.Generated public static BaseService_GetById_M0_MockCall GetById(this global::TUnit.Mocks.Mock mock, global::System.Func? id) where T : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new BaseService_GetById_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "GetById", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -118,7 +118,7 @@ namespace TUnit.Mocks.Generated public static BaseService_Save_M1_MockCall Save(this global::TUnit.Mocks.Mock mock, global::System.Func? entity) where T : class, new() { - global::TUnit.Mocks.Arguments.Arg __fa_entity = entity is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)entity; + global::TUnit.Mocks.Arguments.Arg __fa_entity = entity is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)entity; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_entity.Matcher }; return new BaseService_Save_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Save", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -131,7 +131,7 @@ namespace TUnit.Mocks.Generated public static BaseService_Transform_M2_MockCall Transform(this global::TUnit.Mocks.Mock mock, global::System.Func? input) where TInput : notnull where TResult : struct { - global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)input; + global::TUnit.Mocks.Arguments.Arg __fa_input = input is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(TInput)!) : (global::TUnit.Mocks.Arguments.Arg)input; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_input.Matcher }; return new BaseService_Transform_M2_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 2, "Transform", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt index 76e0040d1ed..9ee9b15beff 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/SelfEquatable_Generates_EqualsOf_GetHashCodeOf_ToStringOf.verified.txt @@ -119,7 +119,7 @@ namespace TUnit.Mocks.Generated public static SelfEquatableSnapshot_Equals_M0_MockCall EqualsOf(this global::TUnit.Mocks.Mock mock, global::System.Func? other) { - global::TUnit.Mocks.Arguments.Arg __fa_other = other is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)other; + global::TUnit.Mocks.Arguments.Arg __fa_other = other is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(global::SelfEquatableSnapshot?)!) : (global::TUnit.Mocks.Arguments.Arg)other; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_other.Matcher }; return new SelfEquatableSnapshot_Equals_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Equals", matchers); } @@ -132,7 +132,7 @@ namespace TUnit.Mocks.Generated public static SelfEquatableSnapshot_Equals_M1_MockCall EqualsOf(this global::TUnit.Mocks.Mock mock, global::System.Func? obj) { - global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)obj; + global::TUnit.Mocks.Arguments.Arg __fa_obj = obj is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(object?)!) : (global::TUnit.Mocks.Arguments.Arg)obj; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_obj.Matcher }; return new SelfEquatableSnapshot_Equals_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Equals", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt index f4e3e13d0af..dad436ee471 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Simple_Interface_With_One_Method.verified.txt @@ -89,7 +89,7 @@ namespace TUnit.Mocks.Generated public static IGreeter_Greet_M0_MockCall Greet(this global::TUnit.Mocks.Mock mock, global::System.Func? name) { - global::TUnit.Mocks.Arguments.Arg __fa_name = name is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)name; + global::TUnit.Mocks.Arguments.Arg __fa_name = name is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)name; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_name.Matcher }; return new IGreeter_Greet_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Greet", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt index 99c0b6ca063..7d45efff688 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Static_Extension_Discovery_Without_Mock_Of.verified.txt @@ -99,7 +99,7 @@ namespace TUnit.Mocks.Generated public static INotifier_Notify_M0_MockCall Notify(this global::TUnit.Mocks.Mock mock, global::System.Func? message) { - global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)message; + global::TUnit.Mocks.Arguments.Arg __fa_message = message is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(string)!) : (global::TUnit.Mocks.Arguments.Arg)message; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_message.Matcher }; return new INotifier_Notify_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Notify", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Type_Mocked_Regularly_And_Wrapped.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Type_Mocked_Regularly_And_Wrapped.verified.txt index 2ba28b7a8c4..07bf75af8f0 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Type_Mocked_Regularly_And_Wrapped.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Type_Mocked_Regularly_And_Wrapped.verified.txt @@ -112,22 +112,22 @@ namespace TUnit.Mocks.Generated public static TestNamespace_Calculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::TUnit.Mocks.Arguments.Arg b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)a; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, b.Matcher }; return new TestNamespace_Calculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } public static TestNamespace_Calculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::TUnit.Mocks.Arguments.Arg a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { a.Matcher, __fa_b.Matcher }; return new TestNamespace_Calculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } public static TestNamespace_Calculator_Add_M0_MockCall Add(this global::TUnit.Mocks.Mock mock, global::System.Func? a, global::System.Func? b) { - global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)a; - global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)b; + global::TUnit.Mocks.Arguments.Arg __fa_a = a is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)a; + global::TUnit.Mocks.Arguments.Arg __fa_b = b is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)b; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_a.Matcher, __fa_b.Matcher }; return new TestNamespace_Calculator_Add_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Add", matchers); } diff --git a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt index 71fcf4956cc..cd549cdcee7 100644 --- a/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt +++ b/tests/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Wrap_Mock_With_Generic_Constrained_Virtual_Methods.verified.txt @@ -14,7 +14,7 @@ namespace TUnit.Mocks.Generated public static Repository_Get_M0_MockCall Get(this global::TUnit.Mocks.Mock mock, global::System.Func? id) where T : class { - global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)id; + global::TUnit.Mocks.Arguments.Arg __fa_id = id is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(int)!) : (global::TUnit.Mocks.Arguments.Arg)id; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_id.Matcher }; return new Repository_Get_M0_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 0, "Get", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } @@ -27,7 +27,7 @@ namespace TUnit.Mocks.Generated public static Repository_Store_M1_MockCall Store(this global::TUnit.Mocks.Mock mock, global::System.Func? item) where T : class, new() { - global::TUnit.Mocks.Arguments.Arg __fa_item = item is null ? global::TUnit.Mocks.Arguments.Arg.IsNull() : (global::TUnit.Mocks.Arguments.Arg)item; + global::TUnit.Mocks.Arguments.Arg __fa_item = item is null ? global::TUnit.Mocks.Arguments.Arg.Is(default(T)!) : (global::TUnit.Mocks.Arguments.Arg)item; var matchers = new global::TUnit.Mocks.Arguments.IArgumentMatcher[] { __fa_item.Matcher }; return new Repository_Store_M1_MockCall(global::TUnit.Mocks.MockRegistry.GetEngine(mock), 1, "Store", matchers, global::TUnit.Mocks.TypeArguments.Of.Value); } diff --git a/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs b/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs index 84515cd50de..14017c1fadd 100644 --- a/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs +++ b/tests/TUnit.Mocks.Tests/NullLiteralMatcherTests.cs @@ -7,28 +7,38 @@ public interface INullLiteralService void Notify(string? value); string NullableNumber(int? value); string Number(int value); + string GenericNumber(T value); } public class NullLiteralMatcherTests { [Test] - public async Task Default_Literal_For_NonNullable_Number_Is_A_Null_Predicate() + public async Task Default_Literal_For_NonNullable_Number_Matches_Zero() { var mock = Mock.Of(); - // An untyped default selects the nullable predicate overload. Null cannot - // match an int; use a typed default to request the exact value zero. - mock.Number(default).Returns("null predicate"); - - await Assert.That(mock.Object.Number(0)).IsEqualTo(""); - mock.Number(default).WasNeverCalled(); - - mock.Number(default(int)).Returns("zero"); + mock.Number(default).Returns("zero"); await Assert.That(mock.Object.Number(0)).IsEqualTo("zero"); await Assert.That(mock.Object.Number(1)).IsEqualTo(""); - mock.Number(default(int)).WasCalled(Times.Exactly(2)); - mock.Number(default).WasNeverCalled(); + mock.Number(default).WasCalled(Times.Once); + mock.Number(default(int)).WasCalled(Times.Once); + } + + [Test] + public async Task Default_Literal_For_Generic_Parameter_Matches_Its_Default_Value() + { + var mock = Mock.Of(); + mock.GenericNumber(default).Returns("zero"); + mock.GenericNumber(default).Returns("null"); + + await Assert.That(mock.Object.GenericNumber(0)).IsEqualTo("zero"); + await Assert.That(mock.Object.GenericNumber(1)).IsEqualTo(""); + await Assert.That(mock.Object.GenericNumber(null)).IsEqualTo("null"); + await Assert.That(mock.Object.GenericNumber("value")).IsEqualTo(""); + + mock.GenericNumber(default).WasCalled(Times.Once); + mock.GenericNumber(default).WasCalled(Times.Once); } [Test]