public void AsOptionForError_IsNoneAndCallbackFired() { var expectedError = "fail"; Either <int, string> either = expectedError; bool wasCalled = false; var option = either.AsOption(e => { wasCalled = true; }); Assert.True(wasCalled); Assert.False(option.IsSome); }
public void AsOptionForSuccess_CarriesValue() { var expectedSucess = 42; Either <int, string> either = expectedSucess; bool wasCalled = false; var option = either.AsOption(e => { wasCalled = true; }); Assert.False(wasCalled); Assert.True(option.IsSome); Assert.Equal(expectedSucess, option.ForceValue()); }