Example #1
0
        public void Analyze_WebServiceThrows_SendsEmail()
        {
            FakeWebService2 stubService = new FakeWebService2();

            stubService.ToThrow = new Exception("fake exception");

            FakeEmailService mockEmail = new FakeEmailService();

            LogAnalyzer2 log = new LogAnalyzer2(stubService, mockEmail);
            string       tooShortFileName = "abc.ext";

            log.Analyze(tooShortFileName);

            StringAssert.Contains("*****@*****.**", mockEmail.To);
            StringAssert.Contains("fake exception", mockEmail.Body);
            StringAssert.Contains("can't log", mockEmail.Subject);
        }
Example #2
0
        public void Analyze_WebServiceThrows_SendsEmail()
        {
            FakeWebService fakeWebService = new FakeWebService();

            fakeWebService.ToThrow = new Exception("fake exception");

            FakeEmailService fakeEmailService = new FakeEmailService();

            LogAnalyzer2 logAnalyzer2     = new LogAnalyzer2(fakeWebService, fakeEmailService);
            string       tooShortFilename = "abc.ext";

            logAnalyzer2.Analyze(tooShortFilename);

            StringAssert.Contains("*****@*****.**", fakeEmailService.To);
            StringAssert.Contains("fake exception", fakeEmailService.Body);
            StringAssert.Contains("can't log", fakeEmailService.Subject);
        }