Raise
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.
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 would look like this:
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.