Fork me on GitHub

Frequently Asked Questions

My class expects an IEnumerable parameter of some type of service, but I can't get SpecsFor to inject it!

You can use the GetMockForEnumerableOf<T> helper method to create an array of mocks that will be injected into the class-under-test. You can retrieve that same set of mock objects later in your tests by calling the GetMockForEnumerableOf<T> method again with the same parameter, as shown in this test case:

Note that you need to create the mocks by overriding the ConfigureContainer method.

The type I'm testing can't be created because of {insert random reason}. How can I tell SpecsFor the right way to create my class?

You can override the InitializeClassUnderTest method and set the SUT property to whatever you want:

Need More Help?

Additional documentation and videos will be coming soon. In the meantime, please feel free to ping me on Twitter or at my blog if you have questions or comments.