Ejemplo n.º 1
0
 public void IfFailure_called_on_a_failed_result()
 {
     var firstInput = new MockInput<int>();
     var remainingInput = new MockInput<int>();
     var expectedResult = new MockParseResult<int, double>();
     var mockParser = new MockFailureParser<int, double>();
     var originalResult = ParseResult.Failure<int, double>(firstInput, mockParser);
     var actualResult = originalResult.IfFailure(
         successfulResult =>
             {
                 Assert.AreEqual(originalResult, successfulResult);
                 return expectedResult;
             }
         );
     Assert.AreEqual(expectedResult, actualResult);
 }
Ejemplo n.º 2
0
 public void IfSuccess_called_on_a_successful_result()
 {
     var firstInput = new MockInput<int>();
     var remainingInput = new MockInput<int>();
     var expectedResult = new MockParseResult<int, double>();
     var originalResult = ParseResult.Success(firstInput, remainingInput, 123);
     var actualResult = originalResult.IfSuccess(
         successfulResult =>
             {
                 Assert.AreEqual(originalResult, successfulResult);
                 return expectedResult;
             }
         );
     Assert.AreEqual(expectedResult, actualResult);
 }