Example #1
0
        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);
        }
Example #2
0
 private static StringCalculator GetStringCalculator(FakeLogger stubWriter, FakeWebService mockWebService)
 {
     var sc = new StringCalculator(new FakeSettings {WillStringCalculatorBeEnabled = true}, stubWriter, mockWebService);
     return sc;
 }
Example #3
0
 private static StringCalculator GetStringCalculator(FakeLogger mockWriter)
 {
     return new StringCalculator(new FakeSettings {WillStringCalculatorBeEnabled = true}, mockWriter, new FakeWebService());
 }
Example #4
0
        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);
        }