Exemplo n.º 1
0
        public void Analyze_TooShortFileName_CallsWebService()
        {
            MockService mockService = new MockService();
            LogAnalyzer log = new LogAnalyzer(mockService);
            string tooShortFileName = "abc.ext";
            log.Analyze(tooShortFileName);

            Assert.AreEqual("Filename too short:abc.ext", mockService.LastError);
        }
        public void Analyze_TooShortFileName_ErrorLoggedtoService_NonStrictMock()
        {
            MockRepository mocks = new MockRepository();
            IWebService simulatedService = mocks.DynamicMock<IWebService>();

            using (mocks.Record())
            {

                simulatedService.LogError("Filename too short:abc.ext");
            }

            LogAnalyzer log = new LogAnalyzer(simulatedService);
            string tooShortFileName = "abc.ext";
               log.Analyze(tooShortFileName);

            mocks.VerifyAll();
        }