public void Solve_WhenExpressionHasAllSolutions_ShouldWriteProperSolution(string expr) { //Arrange SetupSolver(); //Act TestedSolver.Solve(new[] { expr }); //Assert ConsoleMock .Verify(c => c.WriteLine(It.Is <string>( s => s.Contains("All real numbers")))); }
public void Solve_WhenCalledWithInvalidExpression_ShouldWriteError(string expression, string errorMessage) { //Arrange SetupSolver(); //Act TestedSolver.Solve(new[] { expression }); //Assert ConsoleMock .Verify(c => c.WriteLine(It.Is <string>( s => s.Contains(errorMessage)))); }
public void Solve_WhenExpressionHasSingleRationalSolutionAndDegreeOne_ShouldWriteProperSolution(string expr, string x) { //Arrange SetupSolver(); //Act TestedSolver.Solve(new[] { expr }); //Assert ConsoleMock .Verify(c => c.WriteLine(It.Is <string>( s => s.Contains("Degree: 1")))); ConsoleMock .Verify(c => c.WriteLine(It.Is <string>( s => s.Contains($" = {x}")))); }
private void VerifyOutput(string expected) { ConsoleMock.Verify(x => x.WriteLine(StringCalculator.OutputPrefix + expected)); }
public void GivenEmptyInputPrgramExits() { ConsoleMock.SetupSequence(x => x.Readline()).Returns(""); RunMain("1"); ConsoleMock.Verify(x => x.Readline(), Times.Exactly(1)); }
public void AppAlwaysChecksForAnotherInput() { RunMain("1"); ConsoleMock.Verify(x => x.Readline()); }
public void AppAlwaysPromptsForAnotherInput() { RunMain("1"); ConsoleMock.Verify(x => x.WriteLine("Another input please")); }