Skip to content

Commit

Permalink
Update MatchSpec.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
tomohisa committed Jul 26, 2024
1 parent 06cdfa1 commit 508234b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ResultBoxes/ResultBoxes.Test/MatchSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,17 @@ public async Task MatchTest4()
Assert.Equal("err 2", result);
}

[Fact]
public async Task MatchCanReturnNullable()
{
var sut = await ResultBox.FromValue(1).ToTask().Match(value => (int?)value, exception => null);
Assert.Equal(1, sut);
}
[Fact]
public async Task MatchCanReturnNullable2()
{
var sut = await ResultBox.FromException<int>(new ApplicationException("test")).ToTask().Match(value => (int?)value, exception => null);
Assert.Null(sut);
}

}

0 comments on commit 508234b

Please sign in to comment.