private void ShouldReturnFailureWithOriginalErrorIfOtherIsASuccess() { var failure = new Failure <int>(new Error("Error", "Ka")); Result <int> combined = failure.Combine( new Success <int>(2), (i, j) => i + j, (error, otherError) => new Error("Error", $"{error.Detail}-{otherError.Detail}")); combined.Should().BeEquivalentTo(failure); }
private void ShouldCombineErrorsIfTheOtherResultIsAFailure() { var failure = new Failure <int>(new Error("Error", "Ka")); Result <int> combined = failure.Combine( new Failure <int>(new Error("Error", "Boom!")), (i, j) => i + j, (error, otherError) => new Error("Error", $"{error.Detail}-{otherError.Detail}")); combined.Should().BeEquivalentTo(new Failure <int>(new Error("Error", "Ka-Boom!"))); }