public void Main_RequestsInput_UntilNoneIsProvided() { var output = new OutputMock(); var input = new InputMock(); var sc = new StringCalculator(output, input); var expected = new[] { "6", "The result is 6", "another input please", "3", "The result is 3", "another input please", "5", "The result is 5", "another input please", }; sc.Main(new[] { "scalc", "'1,2,3'" }); var actual = output.History; Assert.Equal(expected[0], actual[0]); Assert.Equal(expected[1], actual[1]); Assert.Equal(expected[2], actual[2]); Assert.Equal(expected[3], actual[3]); Assert.Equal(expected[4], actual[4]); Assert.Equal(expected[5], actual[5]); Assert.Equal(expected[6], actual[6]); Assert.Equal(expected[7], actual[7]); Assert.Equal(expected[8], actual[8]); }
public void Main_Writes6ToConsule_When123ProvidedByUser() { var output = new OutputMock(); var sc = new StringCalculator(output); const string expected = "The result is 6"; sc.Main(new [] { "scalc", "'1,2,3'" }); var actual = output.History[output.History.Count - 2]; Assert.Equal(expected, actual); }
public void Add_Sends3ToConsole_WhenPassed1And2() { var logger = new LoggerMock(); var webService = new WebServiceMock(); var output = new OutputMock(); var sc = new StringCalculator(logger, webService, output); const string expected = "3"; sc.Add("1,2"); var actual = output.LastLine; Assert.Equal(expected, actual); }