public void When_projecting_a_successful_result() { var input = new MockInput<int>(); var childParser = new MockSuccessfulParser<int, double>(1.0); var parser = new ProjectionParser<int, double, decimal>(childParser, d => (decimal) d + 3.0m); var actualResult = parser.Parse(input); ParseResultAssert.IsSuccess(actualResult); ParseResultAssert.AreEqual(4.0m, actualResult); }
public void When_projecting_a_failure_result() { var input = new MockInput<int>(); var childParser = new MockFailureParser<int, double>(); var parser = new ProjectionParser<int, double, decimal>(childParser, d => (decimal) d + 3.0m); var actualResult = parser.Parse(input); ParseResultAssert.IsFailure(actualResult); Assert.AreEqual(input, actualResult.FirstInput); }