Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight 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.
Match<(Of <(T>)>)
Allows creation custom value matchers that can be used on setups and verification, completely replacing 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>)>)
Provides a mock implementation of T.
MockException
Exception thrown by mocks when setups are not matched, the mock is not properly setup, etc.
MockExtensions
Provides additional methods on mocks.
MockFactory
Utility factory class to use to construct multiple mocks when consistent verification is desired for all of them.
Mocks
Allows querying the universe of mocks for those that behave according to the query specification.
QueryableMockExtensions
Helper extensions that are used by the query translator.
Times
Defines the number of invocations allowed by a mocked method.

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).