Moq Namespace

Moq 2.6

Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET developed from scratch to take full advantage of .NET 3.5 (i.e. Linq expression trees) and C# 3.0 features (i.e. lambda expressions) that make it the most productive, simple and refactoring-friendly mocking library available.

See the online quickstarts for more examples than those available in this code documentation.

The Mock<T> class is the core of the library, so it's a good place to start.

You can also read blog entries from around the world about Moq.

Classes

  ClassDescription
It
Allows the specification of a matching condition for an argument in a method invocation, rather than a specific argument value. "It" refers to the argument being matched.
MatcherAttribute
Marks a method as a matcher, which allows complete replacement of the built-in It class with your own argument matching rules.
Mock
Base class for mocks and static helper class with methods that apply to mocked objects, such as Get<(Of <(T>)>)(T) to retrieve a Mock<(Of <(T>)>) from an object instance.
Mock<(Of <(T>)>)
Core implementation of the IMock<(Of <(T>)>) interface.
MockedEvent
Represents a generic event that has been mocked and can be rised.
MockedEvent<(Of <(TEventArgs>)>)
Provides a typed MockedEvent for a specific type of EventArgs.
MockException
Exception thrown by mocks when expectations are not met, the mock is not properly setup, etc.
MockFactory
Utility factory class to use to construct multiple mocks when consistent verification is desired for all of them.

Interfaces

  InterfaceDescription
IMock
Base mock interface exposing non-generic members.
IMock<(Of <(T>)>)
Provides a mock implementation of T.

Enumerations

  EnumerationDescription
DefaultValue
Determines the way default values are generated calculated for loose mocks.
MockBehavior
Options to customize the behavior of the mock.
Range
Kind of range to use in a filter specified through IsInRange<(Of <(TValue>)>)(TValue, TValue, Range).