diff --git a/src/ResultBoxes/ResultBoxes.Test/MatchSpec.cs b/src/ResultBoxes/ResultBoxes.Test/MatchSpec.cs index 207bb44..527bbd3 100644 --- a/src/ResultBoxes/ResultBoxes.Test/MatchSpec.cs +++ b/src/ResultBoxes/ResultBoxes.Test/MatchSpec.cs @@ -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(new ApplicationException("test")).ToTask().Match(value => (int?)value, exception => null); + Assert.Null(sut); + } + }