Expect Method (((T)))

Moq 2.6

Sets an expectation on the mocked type for a call to to a void method.

Namespace:  Moq
Assembly:  Moq (in Moq.dll) Version: 2.6.1014.1 (2.6.0.0)

Syntax

C#
IExpect Expect(
	Expression<Action<T>> expression
)

Parameters

expression
Type: Expression<(Of <(Action<(Of <(T>)>)>)>)
Lambda expression that specifies the expected method invocation.

Remarks

If more than one expectation is set for the same method or property, the latest one wins and is the one that will be executed.

Examples

CopyC#
var mock = new Mock<IProcessor>();
mock.Expect(x => x.Execute("ping"));

See Also