Moq.Language Namespace

Moq

Collapse imageExpand ImageCopy imageCopyHover image
This namespace defines the interfaces that contain the methods available in Moq fluent API, such as Setup, 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
Public interfaceICallback
Defines the Callback verb and overloads.
Public interfaceICallback<(Of <(<'TMock, TResult>)>)>
Defines the Callback verb and overloads for callbacks on setups that return a value.
Public interfaceICallbackGetter<(Of <(<'TMock, TProperty>)>)>
Defines the Callback verb for property getter setups.
Public interfaceICallbackSetter<(Of <(<'TProperty>)>)>
Defines the Callback verb for property setter setups.
Public interfaceIRaise<(Of <(<'T>)>)>
Defines the Raises verb.
Public interfaceIReturns<(Of <(<'TMock, TResult>)>)>
Defines the Returns verb.
Public interfaceIReturnsGetter<(Of <(<'TMock, TProperty>)>)>
Defines the Returns verb for property get setups.
Public interfaceISetupConditionResult<(Of <(<'T>)>)>
Implements the fluent API.
Public interfaceISetupSequentialResult<(Of <(<'TResult>)>)>
Language for ReturnSequence
Public interfaceIThrows
Defines the Throws verb.
Public interfaceIVerifies
Defines the Verifiable verb.