[This is preliminary documentation and is subject to change.]

Exposes members available to mocked methods that return a value.

Namespace:  Moq
Assembly:  Moq (in Moq)
Version: 1.5.2951.38938 (1.5.0.0)

Syntax

C#
public interface ICallReturn<TResult> : ICall

Type Parameters

TResult

Remarks

ICall and ICallReturn<(Of <(TResult>)>) are the return type of the two Mock.Expect overloads. These are the two interfaces that enable the rich intellisense in Visual Studio allowing calls with the format mock.Expect(...).Callback(...).Returns(...).

When a call to Expect is performed, the compiler (and Visual Studio intellisense) will automatically pick one interface or the other as the return types depending on the expression passed in the call: if the expression represents a call to a void method, ICall members will be available after the Expect invocation, allowing the specification of a Throws(Exception) or Callback(Action) action, but not a Returns one.

On the other hand, if the expression passed to the Expect method represents a call to a method that returns a value, the additional Returns(TResult) and Returns(Func<(Of <(TResult>)>)) members are available (Throws and Callback are inherited from ICall).

See Also