![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>)>)> Constructor (array<Object>[]()[][]) |
Mock<(Of <(<'T>)>)> Class Example See Also Send Feedback |
Initializes an instance of the mock with default behavior and with
the given constructor arguments for the class. (Only valid when T is a class)
Namespace: Moq
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)
Syntax
C# |
---|
public Mock( params Object[] args ) |
Parameters
- args
- Type: array<System..::..Object>[]()[][]
Optional constructor arguments if the mocked type is a class.
Remarks
The mock will try to find the best match constructor given the constructor arguments, and invoke that
to initialize the instance. This applies only for classes, not interfaces.
Examples
![](CopyCode.gif)
var mock = new Mock<MyProvider>(someArgument, 25);