tkellogg/Moq.AutoMocker — pull request #16 by matthew-cole (2014-08-01 00:45:13+00:00)
Title: Added the ability to use internal/private constructors when mocking.

I'm not sure how many people will find this useful, but at least for my purposes I frequently find myself wanting to mock something like in the example below, and until now have had to create my Mocks manually.

public class MyPublicClass
{
private readonly IMyPrivateService _serviceA;

internal MyPublicClass(IMyPrivateService service)
{
_service = service;
}
...
}

I have simply added an overload `CreateInstance(bool enablePrivate)` to the AutoMocker that turns on non-public constructors. This is achieved by supplying the necessary `BindingFlags` when doing any reflection.