예제 #1
0
 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();
 }
예제 #2
0
        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();
        }