Hi,
I've started using JustMock and I'm wondering how to replicate the example Rhino Mocks sample given here:
http://stackoverflow.com/questions/9364254/verifying-event-handler-exists-in-moq-vs-rhino-mocks
My example is similar to that posted above.
I have an IView that exposes an Event.
I have a Presenter class that takes an IView in its constructor and then attaches to the IView Event.
I want to test that the presenter is actually subscribing to the IView event in its constructor.
Is there a way to do this with JustMock, like how it's shown in the Rhino Mocks example?
Thanks.
Edit Update:
I think I figured it out. Is this correct?
I've started using JustMock and I'm wondering how to replicate the example Rhino Mocks sample given here:
http://stackoverflow.com/questions/9364254/verifying-event-handler-exists-in-moq-vs-rhino-mocks
My example is similar to that posted above.
I have an IView that exposes an Event.
I have a Presenter class that takes an IView in its constructor and then attaches to the IView Event.
I want to test that the presenter is actually subscribing to the IView event in its constructor.
Is there a way to do this with JustMock, like how it's shown in the Rhino Mocks example?
Thanks.
Edit Update:
I think I figured it out. Is this correct?
var view = Mock.Create<IView>();
Mock.ArrangeSet(() => view.MyEvent +=
null
).IgnoreArguments().OccursOnce();
var presenter = Mock.Create<Presenter>(view);
Mock.Assert(view);