Mock(T) Methods

Moq

Collapse imageExpand ImageCopy imageCopyHover image

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

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

See Also