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)
| parameter | description |
|---|---|
| serviceType | The type of service to retrieve |
Return Value
A mock of serviceType
See Also
- class AutoMocker
- namespace Moq.AutoMock
AutoMocker.GetMock method (2 of 4)
Searches and retrieves the mock that the container uses for serviceType.
public Mock GetMock(Type serviceType, bool enablePrivate)
| parameter | description |
|---|---|
| serviceType | The type of service to retrieve |
| enablePrivate | When true, non-public constructors will also be used to create mocks. |
Return Value
A mock of serviceType
See Also
- class AutoMocker
- namespace Moq.AutoMock
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
| parameter | description |
|---|---|
| TService | The class or interface to search on |
Return Value
A mock of TService
Exceptions
| exception | condition |
|---|---|
| ArgumentException | if the requested object wasn't a Mock |
See Also
- class AutoMocker
- namespace Moq.AutoMock
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
| parameter | description |
|---|---|
| TService | The class or interface to search on |
| enablePrivate | When true, non-public constructors will also be used to create mocks. |
Return Value
A mock of TService
Exceptions
| exception | condition |
|---|---|
| ArgumentException | if the requested object wasn't a Mock |
See Also
- class AutoMocker
- namespace Moq.AutoMock