How to test if someone subscribed to an event with Rhino Mocks

Monday, 10 November 2008

Posted by Sébastien Lachance with Comments (0)

Very common scenario. There is probably a better way to do this, but this one get the job done.

var mockedView = MockRepository.GenerateMock<ICustomerView>();
mockedView.Expect(v=>v.Save += null).IgnoreArguments();
mockedView.Expect(v=>v.Delete += null).IgnoreArguments();
mockedView.Expect(v=>v.Load += null).IgnoreArguments();
new CustomerPresenter(mockedView); //Subscribtion to events 
mockedView.VerifyAllExpectations();



blog comments powered by Disqus