JustMock

The Raise method is used for raising mocked events. You can use custom or standard events.

Raising Custom Events

Assume we have the following interface:

Next is an example on how to use Raise to fire custom event.

Here we use Raise to raise foo.CustomEvent and pass "ping" to it. Before acting we have attached a delegate to the event. Executing the delegate will result in assigning the passed string to actual. Finally, we verify that expected and actual have the same value.

Raising Standard Events

Assume we have the following system under test:

An example on how to use Raise to fire standard event.

Here we use Raise to raise a standard event - executor.Done accepting FooArgs object. The attached delegate sets the Value property in FooArgs object to the variable actual. Finally, we verify that expected and actual have the same value.

See Also

Other Resources

[b9461116-b200-4739-aff1-af8458c7095e]