AutoMocker.Get method (1 of 4)

April 20, 2021 · View on GitHub

Searches and retrieves an object from the container that matches the serviceType. This can be a service setup explicitly via .Use() or implicitly with .CreateInstance().

public object Get(Type serviceType)
parameterdescription
serviceTypeThe type of service to retrieve

See Also


AutoMocker.Get method (2 of 4)

Searches and retrieves an object from the container that matches the serviceType. This can be a service setup explicitly via .Use() or implicitly with .CreateInstance().

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

See Also


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

Searches and retrieves an object from the container that matches TService. This can be a service setup explicitly via .Use() or implicitly with .CreateInstance().

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

Return Value

The object that implements TService

See Also


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

Searches and retrieves an object from the container that matches TService. This can be a service setup explicitly via .Use() or implicitly with .CreateInstance().

public TService Get<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

The object that implements TService

See Also