UnityAutoMoq
UnityAutoMoq copied to clipboard
Add next code to register mock and objec with one call
This speeds up registering custom mock in base class of test (e.g. MyRepository) and then resolving mock in child to tune base behavior:
public static class UnityMoqContainerExtensions
{
public static IUnityContainer RegisterMock<T>(this IUnityContainer self, Mock<T> mock)
where T:class
{
return self.RegisterInstance(mock).RegisterInstance(mock.Object);
}
}