public void Analyze_TooShortFileName_CallsWebService()
        {
            DynamicMock mockController = new DynamicMock(typeof (IWebService));
            mockController.Expect("LogError", "Filename too short:abc.ext");

            IWebService mockService = mockController.MockInstance as IWebService;

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

            mockController.Verify();
        }
        public void StubThatThrowsException_RhinoMocks()
        {
            IWebService simulatedService = MockRepository.GenerateStub<IWebService>();
            simulatedService
                .Expect(t => t.LogError(""))
                .Throw(new Exception("fake exception"))
                .Constraints(Is.Anything());

            LogAnalyzer log = new LogAnalyzer(simulatedService);
            log.Analyze("abc.ext");
        }
        public void CreateMock_WithReplayAll_AAA()
        {
            MockRepository mockEngine = new MockRepository();
            IWebService simulatedService = mockEngine.DynamicMock<IWebService>();
            LogAnalyzer log = new LogAnalyzer(simulatedService);
            mockEngine.ReplayAll();
            log.Analyze("abc.ext");

            simulatedService.AssertWasCalled(svc => svc.LogError("Filename too short:abc.ext"));
        }
        public void CreateMock_WithReplayAll()
        {
            MockRepository mockEngine = new MockRepository();
            IWebService simulatedService = mockEngine.DynamicMock<IWebService>();
            using (mockEngine.Record())
            {
                simulatedService.LogError("expected input");
            }
            LogAnalyzer log = new LogAnalyzer(simulatedService);
            string tooShortFileName = "abc.ext";
            log.Analyze(tooShortFileName);

            mockEngine.VerifyAll();
        }