Substituting your own fake objects

Sometimes you don't want SpecsFor to create a mock object for you. Instead, you may wish for SpecsFor to inject your own custom fake object instead. You can do this by registering a concrete type in the auto-mocking container.

Note that you will NOT be able to retrieve an instance of your fake object using the standard GetMockFor helper method. Instead, you will need to access the underlying auto-mocking container directly. This container is exposed in the MockContainer property of the base SpecsFor class.


Did this page help you?