![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>)>)>..::..Setup Method (Expression<(Of <(<'Action<(Of <(<'T>)>)>>)>)>) |
Mock<(Of <(<'T>)>)> Class Example See Also Send Feedback |
Specifies a setup on the mocked type for a call to
to a void method.
Namespace: Moq
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)
Syntax
C# |
---|
public ISetup<T> Setup( Expression<Action<T>> expression ) |
Parameters
- expression
- Type: System.Linq.Expressions..::..Expression<(Of <(<'Action<(Of <(<'T>)>)>>)>)>
Lambda expression that specifies the expected method invocation.
Remarks
If more than one setup is specified for the same method or property,
the latest one wins and is the one that will be executed.
Examples
![](CopyCode.gif)
var mock = new Mock<IProcessor>(); mock.Setup(x => x.Execute("ping"));