public void Analyze_WebServiceThrows_SendsEmail()
{
MockRepository mocks = new MockRepository();
IWebService stubService = mocks.Stub<IWebService>();
IEmailService mockEmail =mocks.CreateMock<IEmailService>();
using(mocks.Record())
{
stubService.LogError("whatever");
LastCall.Constraints(Is.Anything());
LastCall.Throw(new Exception("fake exception"));
mockEmail.SendEmail("a","subject","fake exception");
}
LogAnalyzer2 log = new LogAnalyzer2();
log.Service = stubService;
log.Email = mockEmail;
string tooShortFileName = "abc.ext";
log.Analyze(tooShortFileName);
mocks.VerifyAll();
}