AutoMocker.CreateInstance method (1 of 4)
April 20, 2021 · View on GitHub
Constructs an instance from known services. Any dependencies (constructor arguments) are fulfilled by searching the container or, if not found, automatically generating mocks.
public object CreateInstance(Type type)
| parameter | description |
|---|---|
| type | A concrete type |
Return Value
An instance of type with all constructor arguments derived from services setup in the container.
See Also
- class AutoMocker
- namespace Moq.AutoMock
AutoMocker.CreateInstance method (2 of 4)
Constructs an instance from known services. Any dependencies (constructor arguments) are fulfilled by searching the container or, if not found, automatically generating mocks.
public object CreateInstance(Type type, bool enablePrivate)
| parameter | description |
|---|---|
| type | A concrete type |
| enablePrivate | When true, non-public constructors will also be used to create mocks. |
Return Value
An instance of type with all constructor arguments derived from services setup in the container.
See Also
- class AutoMocker
- namespace Moq.AutoMock
AutoMocker.CreateInstance<T> method (3 of 4)
Constructs an instance from known services. Any dependencies (constructor arguments) are fulfilled by searching the container or, if not found, automatically generating mocks.
public T CreateInstance<T>()
where T : class
| parameter | description |
|---|---|
| T | A concrete type |
Return Value
An instance of T with all constructor arguments derived from services setup in the container.
See Also
- class AutoMocker
- namespace Moq.AutoMock
AutoMocker.CreateInstance<T> method (4 of 4)
Constructs an instance from known services. Any dependencies (constructor arguments) are fulfilled by searching the container or, if not found, automatically generating mocks.
public T CreateInstance<T>(bool enablePrivate)
where T : class
| parameter | description |
|---|---|
| T | A concrete type |
| enablePrivate | When true, non-public constructors will also be used to create mocks. |
Return Value
An instance of T with all constructor arguments derived from services setup in the container.
See Also
- class AutoMocker
- namespace Moq.AutoMock