Mock Members

Moq

Collapse imageExpand ImageCopy imageCopyHover image

The Mock type exposes the following members.

Constructors

  NameDescription
Protected methodMock
Initializes a new instance of the Mock class.

Methods

  NameDescription
Public methodAs<(Of <<'(TInterface>)>>)
Adds an interface implementation to the mock, allowing setups to be specified for it.
Public methodStatic memberGet<(Of <<'(T>)>>)
Retrieves the mock object for the given object instance.
Public methodStatic memberOf<(Of <<'(T>)>>)()()()()
Creates an mock object of the indicated type.
Public methodStatic memberOf<(Of <<'(T>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>))
Protected methodOnGetObject
Returns the mocked object value.
Public methodSetReturnsDefault<(Of <<'(TReturn>)>>)
Public methodVerify
Verifies that all verifiable expectations have been met.
Public methodVerifyAll
Verifies all expectations regardless of whether they have been flagged as verifiable.

Properties

  NameDescription
Public propertyBehavior
Behavior of the mock, according to the value set in the constructor.
Public propertyCallBase
Whether the base member virtual implementation will be called for mocked classes if no setup is matched. Defaults to falseFalsefalsefalse (False in Visual Basic).
Public propertyDefaultValue
Specifies the behavior to use when returning default values for unexpected invocations on loose mocks.
Public propertyObject
Gets the mocked object instance.

See Also