You can use the Fire
class to fire events published by mocks:
Fire.Event("EventName").On(mock).With(this, EventArgs.Empty);
The Event
method takes the event name as a method argument.
You define the mock that is firing the event with the On
method.
Finally, you pass the event handler parameters to the With
method. If your event uses EventHandler
as its delegate type these arguments are the sender and an EventArgs
object. If you use other delegate types then you have
to pass the same objects that you expect to be passed to the handler on your code under test.