Mock(T) Members

Moq

Collapse imageExpand ImageCopy imageCopyHover image

The Mock<(Of <(<'T>)>)> type exposes the following members.

Constructors

  NameDescription
Public methodMock<(Of <(<'T>)>)>()()()()
Initializes an instance of the mock with default behavior.
Public methodMock<(Of <(<'T>)>)>(array<Object>[]()[][])
Initializes an instance of the mock with default behavior and with the given constructor arguments for the class. (Only valid when T is a class)
Public methodMock<(Of <(<'T>)>)>(MockBehavior)
Initializes an instance of the mock with the specified behavior.
Public methodMock<(Of <(<'T>)>)>(MockBehavior, array<Object>[]()[][])
Initializes an instance of the mock with a specific behavior with the given constructor arguments for the class.

Methods

  NameDescription
Public methodAs<(Of <<'(TInterface>)>>)
Adds an interface implementation to the mock, allowing setups to be specified for it.
(Inherited from Mock.)
Protected methodOnGetObject
Returns the mocked object value.
(Overrides Mock..::..OnGetObject()()()().)
Public methodRaise(Action<(Of <<'(T>)>>), EventArgs)
Raises the event referenced in eventExpression using the given args argument.
Public methodRaise(Action<(Of <<'(T>)>>), array<Object>[]()[][])
Raises the event referenced in eventExpression using the given args argument for a non-EventHandler typed event.
Public methodSetReturnsDefault<(Of <<'(TReturn>)>>) (Inherited from Mock.)
Public methodSetup(Expression<(Of <<'(Action<(Of <<'(T>)>>)>)>>))
Specifies a setup on the mocked type for a call to to a void method.
Public methodSetup<(Of <<'(TResult>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>))
Public methodSetupAllProperties
Specifies that the all properties on the mock should have "property behavior", meaning that setting its value will cause it to be saved and later returned when the property is requested. (this is also known as "stubbing"). The default value for each property will be the one generated as specified by the DefaultValue property for the mock.
Public methodSetupGet<(Of <<'(TProperty>)>>)
Public methodSetupProperty<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>))
Public methodSetupProperty<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean)
Public methodSetupSet(Action<(Of <<'(T>)>>))
Specifies a setup on the mocked type for a call to to a property setter.
Public methodSetupSet<(Of <<'(TProperty>)>>)(Action<(Of <<'(T>)>>))
Specifies a setup on the mocked type for a call to to a property setter.
Public methodVerify()()()()
Verifies that all verifiable expectations have been met.
(Inherited from Mock.)
Public methodVerify(Expression<(Of <<'(Action<(Of <<'(T>)>>)>)>>))
Verifies that a specific invocation matching the given expression was performed on the mock. Use in conjuntion with the default Loose.
Public methodVerify(Expression<(Of <<'(Action<(Of <<'(T>)>>)>)>>), Times)
Verifies that a specific invocation matching the given expression was performed on the mock. Use in conjuntion with the default Loose.
Public methodVerify(Expression<(Of <<'(Action<(Of <<'(T>)>>)>)>>), String)
Verifies that a specific invocation matching the given expression was performed on the mock, specifying a failure error message. Use in conjuntion with the default Loose.
Public methodVerify(Expression<(Of <<'(Action<(Of <<'(T>)>>)>)>>), Times, String)
Verifies that a specific invocation matching the given expression was performed on the mock, specifying a failure error message. Use in conjuntion with the default Loose.
Public methodVerify<(Of <<'(TResult>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>))
Public methodVerify<(Of <<'(TResult>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean)
Public methodVerify<(Of <<'(TResult>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean, T)
Public methodVerifyAll
Verifies all expectations regardless of whether they have been flagged as verifiable.
(Inherited from Mock.)
Public methodVerifyGet<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>))
Public methodVerifyGet<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean)
Public methodVerifyGet<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean, T)
Public methodVerifySet(Action<(Of <<'(T>)>>))
Verifies that a property was set on the mock.
Public methodVerifySet(Action<(Of <<'(T>)>>), Times)
Verifies that a property was set on the mock.
Public methodVerifySet(Action<(Of <<'(T>)>>), String)
Verifies that a property was set on the mock, specifying a failure message.
Public methodVerifySet(Action<(Of <<'(T>)>>), Times, String)
Verifies that a property was set on the mock, specifying a failure message.
Public methodWhen

Extension Methods

Properties

  NameDescription
Public propertyBehavior
Behavior of the mock, according to the value set in the constructor.
(Inherited from Mock.)
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).
(Inherited from Mock.)
Public propertyDefaultValue
Specifies the behavior to use when returning default values for unexpected invocations on loose mocks.
(Inherited from Mock.)
Public propertyObject
Exposes the mocked object instance.

See Also