Skip to content

Commit

Permalink
Improved test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Oct 7, 2024
1 parent 71c4beb commit 7c97196
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/DotNext.Tests/DelegateHelpersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,17 @@ public static async Task ToAsync5()
func = new Func<int, int>(static _ => throw new Exception()).ToAsync();
await ThrowsAsync<Exception>(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<int>(static () => throw new Exception()).ToAsync();
await ThrowsAsync<Exception>(func.Invoke(new(canceled: false)).AsTask);
}

[Fact]
public static void HideReturnValue1()
Expand Down

0 comments on commit 7c97196

Please sign in to comment.