![Collapse image Collapse image](collapse_all.gif)
![Expand Image Expand Image](expand_all.gif)
![](collapse_all.gif)
![](expand_all.gif)
![](dropdown.gif)
![](dropdownHover.gif)
![Copy image Copy image](icons/copycode.gif)
![CopyHover image CopyHover image](copycodeHighlight.gif)
![]() |
Moq |
Mock<(Of <(<'T>)>)>..::..Raise Method (Action<(Of <(<'T>)>)>, array<Object>[]()[][]) |
Mock<(Of <(<'T>)>)> Class Example See Also Send Feedback |
Raises the event referenced in eventExpression using
the given args argument for a non-EventHandler typed event.
Namespace: Moq
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)
Syntax
Parameters
- eventExpression
- Type: System..::..Action<(Of <(<'T>)>)>
- args
- Type: array<System..::..Object>[]()[][]
Examples
The following example shows how to raise a custom event that does not adhere to
the standard EventHandler:
CopyC#
![](CopyCode.gif)
var mock = new Mock<IViewModel>(); mock.Raise(x => x.MyEvent -= null, "Name", bool, 25);
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentException | The args arguments are invalid for the target event invocation, or the eventExpression is not an event attach or detach expression. |