diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt
index ef90b8fdde..f28d3e5304 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_Inheriting_Multiple_Interfaces.verified.txt
@@ -1,4 +1,4 @@
-//
+//
#nullable enable
namespace TUnit.Mocks.Generated
@@ -129,6 +129,8 @@ namespace TUnit.Mocks.Generated
return new global::TUnit.Mocks.Setup.VoidMethodSetupBuilder(setup);
})!;
+ ///
+ public IReadWriter_Write_M2_MockCall Returns() { EnsureSetup().Returns(); return this; }
///
public IReadWriter_Write_M2_MockCall Throws() where TException : global::System.Exception, new() { EnsureSetup().Throws(); return this; }
///
diff --git a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt
index 6dd209e2bc..3f08ae5dc2 100644
--- a/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt
+++ b/TUnit.Mocks.SourceGenerator.Tests/Snapshots/Interface_With_Async_Methods.verified.txt
@@ -1,4 +1,4 @@
-//
+//
#nullable enable
namespace TUnit.Mocks.Generated
@@ -47,6 +47,11 @@ namespace TUnit.Mocks.Generated
try
{
var __result = _engine.HandleCallWithReturn(0, "GetValueAsync", new object?[] { key }, "");
+ if (global::TUnit.Mocks.Setup.RawReturnContext.TryConsume(out var __rawAsync))
+ {
+ if (__rawAsync is global::System.Threading.Tasks.Task __typedAsync) return __typedAsync;
+ throw new global::System.InvalidOperationException($"ReturnsAsync: expected global::System.Threading.Tasks.Task but got {__rawAsync?.GetType().Name ?? "null"}");
+ }
return global::System.Threading.Tasks.Task.FromResult(__result);
}
catch (global::System.Exception __ex)
@@ -60,6 +65,11 @@ namespace TUnit.Mocks.Generated
try
{
_engine.HandleCall(1, "DoWorkAsync", global::System.Array.Empty