public void Add_Always_CallsLoggerWithSum(string input, string expectedOutput) { var mockWriter = new FakeLogger(); var sc = GetStringCalculator(mockWriter); sc.Add(input); StringAssert.Contains(expectedOutput, mockWriter.WriteMethodValue); }
private static StringCalculator GetStringCalculator(FakeLogger stubWriter, FakeWebService mockWebService) { var sc = new StringCalculator(new FakeSettings {WillStringCalculatorBeEnabled = true}, stubWriter, mockWebService); return sc; }
private static StringCalculator GetStringCalculator(FakeLogger mockWriter) { return new StringCalculator(new FakeSettings {WillStringCalculatorBeEnabled = true}, mockWriter, new FakeWebService()); }
public void Add_WhenLoggerThrowsException_NotifyWebservice(string input) { var mockWebService = new FakeWebService(); var stubWriter = new FakeLogger { WillThrow = new Exception("SomeMessage") }; var sc = GetStringCalculator(stubWriter, mockWebService); sc.Add(input); StringAssert.Contains("SomeMessage", mockWebService.WriteMessage); }