Moq Namespace

Moq

Collapse imageExpand ImageCopy imageCopyHover image
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
Public classIt
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.
Public classMock
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.
Public classMock<(Of <(<'T>)>)>
Provides a mock implementation of T.
Public classMockException
Exception thrown by mocks when setups are not matched, the mock is not properly setup, etc.
Public classMockExtensions
Provides additional methods on mocks.
Public classMockFactory Obsolete.
Utility factory class to use to construct multiple mocks when consistent verification is desired for all of them.
Public classMockRepository
Utility repository class to use to construct multiple mocks when consistent verification is desired for all of them.
Public classMocks
Allows querying the universe of mocks for those that behave according to the LINQ query specification.
Public classMockSequence
Helper class to setup a full trace between many mocks
Public classMockSequenceHelper
define nice api
Public classSequenceExtensions
Helper for sequencing return values in the same method.

Structures

  StructureDescription
Public structureTimes
Defines the number of invocations allowed by a mocked method.

Enumerations

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