Moq |
Mock<(Of <(<'T>)>)> Members |
Mock<(Of <(<'T>)>)> Class Constructors Methods Properties See Also Send Feedback |
The Mock<(Of <(<'T>)>)> type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Mock<(Of <(<'T>)>)>()()()() |
Initializes an instance of the mock with default behavior.
| |
Mock<(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)
| |
Mock<(Of <(<'T>)>)>(MockBehavior) |
Initializes an instance of the mock with the specified behavior.
| |
Mock<(Of <(<'T>)>)>(MockBehavior, array<Object>[]()[][]) |
Initializes an instance of the mock with a specific behavior with
the given constructor arguments for the class.
|
Methods
Name | Description | |
---|---|---|
As<(Of <<'(TInterface>)>>) |
Adds an interface implementation to the mock,
allowing setups to be specified for it.
(Inherited from Mock.) | |
OnGetObject |
Returns the mocked object value.
(Overrides Mock..::..OnGetObject()()()().) | |
Raise(Action<(Of <<'(T>)>>), EventArgs) |
Raises the event referenced in eventExpression using
the given args argument.
| |
Raise(Action<(Of <<'(T>)>>), array<Object>[]()[][]) |
Raises the event referenced in eventExpression using
the given args argument for a non-EventHandler typed event.
| |
SetReturnsDefault<(Of <<'(TReturn>)>>) | (Inherited from Mock.) | |
Setup(Expression<(Of <<'(Action<(Of <<'(T>)>>)>)>>)) |
Specifies a setup on the mocked type for a call to
to a void method.
| |
Setup<(Of <<'(TResult>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>)) | ||
SetupAllProperties |
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.
| |
SetupGet<(Of <<'(TProperty>)>>) | ||
SetupProperty<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>)) | ||
SetupProperty<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean) | ||
SetupSet(Action<(Of <<'(T>)>>)) |
Specifies a setup on the mocked type for a call to
to a property setter.
| |
SetupSet<(Of <<'(TProperty>)>>)(Action<(Of <<'(T>)>>)) |
Specifies a setup on the mocked type for a call to
to a property setter.
| |
Verify()()()() |
Verifies that all verifiable expectations have been met.
(Inherited from Mock.) | |
Verify(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.
| |
Verify(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.
| |
Verify(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.
| |
Verify(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.
| |
Verify<(Of <<'(TResult>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>)) | ||
Verify<(Of <<'(TResult>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean) | ||
Verify<(Of <<'(TResult>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean, T) | ||
VerifyAll |
Verifies all expectations regardless of whether they have
been flagged as verifiable.
(Inherited from Mock.) | |
VerifyGet<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>)) | ||
VerifyGet<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean) | ||
VerifyGet<(Of <<'(TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean, T) | ||
VerifySet(Action<(Of <<'(T>)>>)) |
Verifies that a property was set on the mock.
| |
VerifySet(Action<(Of <<'(T>)>>), Times) |
Verifies that a property was set on the mock.
| |
VerifySet(Action<(Of <<'(T>)>>), String) |
Verifies that a property was set on the mock, specifying
a failure message.
| |
VerifySet(Action<(Of <<'(T>)>>), Times, String) |
Verifies that a property was set on the mock, specifying
a failure message.
| |
When |
Extension Methods
Name | Description | |
---|---|---|
InSequence<(Of <<'(TMock>)>>) |
Perform an expectation in the trace.
(Defined by MockSequenceHelper.) | |
Protected<(Of <<'(T>)>>) |
Enable protected setups for the mock.
(Defined by ProtectedExtension.) | |
SetupSequence<(Of <<'(TMock, TResult>)>>) | (Defined by SequenceExtensions.) | |
SetupSet<(Of <<'(T, TProperty>)>>) | (Defined by MockExtensions.) | |
VerifySet<(Of <<'(T, TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>)) | Overloaded. (Defined by MockExtensions.) | |
VerifySet<(Of <<'(T, TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean) | Overloaded. (Defined by MockExtensions.) | |
VerifySet<(Of <<'(T, TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean) | Overloaded. (Defined by MockExtensions.) | |
VerifySet<(Of <<'(T, TProperty>)>>)(Expression<(Of <<'(Func<(Of <(<'T, TResult>)>)>>)>>), Boolean, T) | Overloaded. (Defined by MockExtensions.) |
Properties
Name | Description | |
---|---|---|
Behavior |
Behavior of the mock, according to the value set in the constructor.
(Inherited from Mock.) | |
CallBase |
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.) | |
DefaultValue |
Specifies the behavior to use when returning default values for
unexpected invocations on loose mocks.
(Inherited from Mock.) | |
Object |
Exposes the mocked object instance.
|