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