diff --git a/src/DotNext.Tests/DelegateHelpersTests.cs b/src/DotNext.Tests/DelegateHelpersTests.cs index 108a90123..14ced299d 100644 --- a/src/DotNext.Tests/DelegateHelpersTests.cs +++ b/src/DotNext.Tests/DelegateHelpersTests.cs @@ -554,6 +554,17 @@ public static async Task ToAsync5() func = new Func(static _ => throw new Exception()).ToAsync(); await ThrowsAsync(func.Invoke(42, new(canceled: false)).AsTask); } + + [Fact] + public static async Task ToAsync6() + { + var func = Func.Constant(42).ToAsync(); + Equal(42, await func.Invoke(new(canceled: false))); + True(func.Invoke(new(canceled: true)).IsCanceled); + + func = new Func(static () => throw new Exception()).ToAsync(); + await ThrowsAsync(func.Invoke(new(canceled: false)).AsTask); + } [Fact] public static void HideReturnValue1()