AutoMocker.GetMock method (1 of 4)

April 20, 2021 · View on GitHub

Searches and retrieves the mock that the container uses for serviceType.

public Mock GetMock(Type serviceType)
parameterdescription
serviceTypeThe type of service to retrieve

Return Value

A mock of serviceType

See Also


AutoMocker.GetMock method (2 of 4)

Searches and retrieves the mock that the container uses for serviceType.

public Mock GetMock(Type serviceType, bool enablePrivate)
parameterdescription
serviceTypeThe type of service to retrieve
enablePrivateWhen true, non-public constructors will also be used to create mocks.

Return Value

A mock of serviceType

See Also


AutoMocker.GetMock<TService> method (3 of 4)

Searches and retrieves the mock that the container uses for TService.

public Mock<TService> GetMock<TService>()
    where TService : class
parameterdescription
TServiceThe class or interface to search on

Return Value

A mock of TService

Exceptions

exceptioncondition
ArgumentExceptionif the requested object wasn't a Mock

See Also


AutoMocker.GetMock<TService> method (4 of 4)

Searches and retrieves the mock that the container uses for TService.

public Mock<TService> GetMock<TService>(bool enablePrivate)
    where TService : class
parameterdescription
TServiceThe class or interface to search on
enablePrivateWhen true, non-public constructors will also be used to create mocks.

Return Value

A mock of TService

Exceptions

exceptioncondition
ArgumentExceptionif the requested object wasn't a Mock

See Also