Click or drag to resize

MockRegistrationExtensionsRegisterMockTMocked Method

Register a mock by explicitly providing a Mock instance for the service being mocked.

Namespace:  Autofac.Extras.Moq
Assembly:  Autofac.Extras.Moq (in Autofac.Extras.Moq.dll) Version: 6.0.0+4195b730a1f4c2330f7a6e7642c9ad63581968b7
Syntax
public static IRegistrationBuilder<TMocked, SimpleActivatorData, SingleRegistrationStyle> RegisterMock<TMocked>(
	this ContainerBuilder builder,
	Mock<TMocked> mock
)
where TMocked : class

Parameters

builder
Type: AutofacContainerBuilder
The container builder.
mock
Type: MockTMocked
The mock.

Type Parameters

TMocked
The type of service.

Return Value

Type: IRegistrationBuilderTMocked, SimpleActivatorData, SingleRegistrationStyle
The registration builder.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ContainerBuilder. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also