public void RunsTheApplicationMoreThanOnce(int value1, string again1, int value2, string again2) { var mockPrimeFactorService = new MockPrimeFactorService().StubGenerateToReturn(new List <int> { value1 }, new List <int> { value2 }); var mockInputOutput = new MockInputOutput().StubAskToReturn(value1.ToString(), again1, value2.ToString(), again2); var application = BuildApplication(mockInputOutput, mockPrimeFactorService); application.Run(); mockPrimeFactorService.VerifyGenerateCalledWith(value1); mockPrimeFactorService.VerifyGenerateCalledWith(value2); mockInputOutput.VerifyAskCalledWith(Application.FACTOR_QUESTION, 2); mockInputOutput.VerifyWriteCalledWith(string.Format(Application.PRIME_FACTORS_FORMAT, value1)); mockInputOutput.VerifyWriteCalledWith(string.Format(Application.PRIME_FACTORS_FORMAT, value2)); mockInputOutput.VerifyAskCalledWith(Application.AGAIN_QUESTION, 2); }
public void ExitIfFactorQuestionIfInvalid() { var mockInputOutput = new MockInputOutput().StubAskToReturn(""); var application = BuildApplication(mockInputOutput); application.Run(); mockInputOutput.VerifyAskCalledWith(Application.FACTOR_QUESTION); mockInputOutput.VerifyWriteCalledWith(Application.FACTOR_VALIDATION, 0); }