Specifies a setup on the mocked type for a call to a void method. All parameters are filled with IsAny according to the parameter's type.
public static ISetup<T> SetupWithAny<T>(this Mock<T> mock, string methodName)
where T : class| parameter | description |
|---|---|
| T | Type of the mock |
| mock | The mock |
| methodName | The name of the expected method invocation. |
| exception | condition |
|---|---|
| ArgumentNullException | When mock or methodName is null. |
| MissingMethodException | Thrown when no method with methodName is found. |
| AmbiguousMatchException | Thrown when more that one method matches the passed method name. |
This may only be used on methods that are not overloaded.
- class MockExtensions
- namespace Moq.AutoMock
Specifies a setup on the mocked type for a call to a non-void (value-returning) method. All parameters are filled with IsAny according to the parameter's type.
public static ISetup<T, TResult> SetupWithAny<T, TResult>(this Mock<T> mock, string methodName)
where T : class| parameter | description |
|---|---|
| T | Type of the mock |
| TResult | The return type of the method |
| mock | The mock |
| methodName | The name of the expected method invocation. |
| exception | condition |
|---|---|
| ArgumentNullException | When mock or methodName is null. |
| MissingMethodException | Thrown when no method with methodName is found. |
| AmbiguousMatchException | Thrown when more that one method matches the passed method name. |
This may only be used on methods that are not overloaded.
- class MockExtensions
- namespace Moq.AutoMock