public void AlternativeFailureYieldsSecond() { var expected = "second".AsEither <String, Exception>(); var actual = Either <String, Exception> .CreateError(new Exception("boo")) .Alternatively("second".AsEither <String, Exception>()); Assert.Equal(expected, actual); }
public void MapErrorSameTypes() { var expected = "NewError"; var initial = Either <string, string> .CreateError("Error"); var result = initial.MapError(_ => expected); Assert.True(result.IsError); Assert.False(result.IsSuccess); Assert.Equal(expected, result.AsError.Value); }
public void MapErrorSameFinalType() { var expected = DateTime.Now; var initial = Either <DateTime, string> .CreateError("Error"); var result = initial.MapError(_ => expected); Assert.True(result.IsError); Assert.False(result.IsSuccess); Assert.Equal(expected, result.AsError.Value); }