Moq.Language Namespace

Moq 2.6

This namespace defines the interfaces that contain the methods available in Moq fluent API, such as Expect, Callback, Returns, Throws, etc.

Review the documentation of the available methods on these interfaces for code examples. The way these interfaces are composed, grouped and made visible at different stages during an expectation (i.e. Verifiable is the last "verb" and can't be specified before the Returns) is internal but the API will naturally lead you to the proper way of using it, so don't worry too much about who (and where) exposes these language interfaces. They will show up in Intellisense when it's appropriate.

Do use their documentation to learn about options (especially when there are several overloads available) that may be a better fit for a particular scenario.

Interfaces

  InterfaceDescription
ICallback
Defines the Callback verb and overloads.
ICallback<(Of <(TResult>)>)
Defines the Callback verb and overloads for callbacks on expectations that return a value.
ICallbackGetter<(Of <(TProperty>)>)
Defines the Callback verb for property getter expectations.
ICallbackSetter<(Of <(TProperty>)>)
Defines the Callback verb for property setter expectations.
INever
Defines the Never verb.
IOccurrence
Defines occurrence members to constraint expectations.
IRaise
Defines the Raises verb.
IReturns
Base interface for IReturns<(Of <(TResult>)>).
IReturns<(Of <(TResult>)>)
Defines the Returns verb.
IReturnsGetter<(Of <(TProperty>)>)
Defines the Returns verb for property get expectations.
IThrows
Defines the Throws verb.
IVerifies
Defines the Verifiable verb.