Table of Contents

Class MoqContainer

Namespace
Mokkit.Containers.Moq
Assembly
Mokkit.Containers.Moq.dll

Mokkit container backed by Moq. Mocks are resolved by their Mock<T> wrapper type (so tests can Setup/Verify them) while the underlying mock.Object is injected into the real graph.

public class MoqContainer : BaseMockContainer<Mock>, IDependencyContainer

Inheritance

BaseDependencyContainer
BaseMockContainer<Mock>

Implements

IDependencyContainer

Inherited Members

BaseMockContainer<Mock>.GetResolveKey(Mock, Type)
BaseMockContainer<Mock>.GetInjectable(Mock)
BaseMockContainer<Mock>.BeginScope(TestHostContext)

Methods

GetInjectable(Mock)

Returns the object to inject into the real graph (deposited into the bag). For a wrapper-based framework this is the produced object (e.g. mock.Object); for a substitute-is-object framework this is the mock itself.

protected override object? GetInjectable(Mock mock)

Parameters

mock Mock

The materialized mock.

Returns

object?

The injectable object, or null.

GetResolveKey(Mock, Type)

Returns the type under which a materialized mock is resolved. For a wrapper-based framework this is the wrapper type (e.g. Mock<T>); for a framework whose substitute is the object itself this is the mocked type.

protected override Type GetResolveKey(Mock mock, Type innerType)

Parameters

mock Mock

The materialized mock.

innerType Type

The mocked type recorded at registration.

Returns

Type

The resolution key type.