Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 1.97 KB

File metadata and controls

68 lines (47 loc) · 1.97 KB

MockExtensions.SetupWithAny<T> method (1 of 2)

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.

Exceptions

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.

Remarks

This may only be used on methods that are not overloaded.

See Also


MockExtensions.SetupWithAny<T,TResult> method (2 of 2)

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.

Exceptions

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.

Remarks

This may only be used on methods that are not overloaded.

See Also