public void VerifyingThatAnEventWasFired() { MockRepository mocks = new MockRepository(); IEventSubscriber subscriber = mocks.StrictMock<IEventSubscriber>(); IWithEvents events = new WithEvents(); // This doesn't create an expectation because no method is called on subscriber!! events.Blah += new EventHandler(subscriber.Handler); subscriber.Handler(events, EventArgs.Empty); mocks.ReplayAll(); events.RaiseEvent(); mocks.VerifyAll(); }
public void VerifyingThatAnEventWasFired() { MockRepository mocks = new MockRepository(); IEventSubscriber subscriber = mocks.StrictMock <IEventSubscriber>(); IWithEvents events = new WithEvents(); // This doesn't create an expectation because no method is called on subscriber!! events.Blah += new EventHandler(subscriber.Handler); subscriber.Handler(events, EventArgs.Empty); mocks.ReplayAll(); events.RaiseEvent(); mocks.VerifyAll(); }