public MockCreationResult CreateANewMockObjectAndRegisterIt <T>(MockBehavior mockBehavior = MockBehavior.Default) where T : class { var result = CreateAMockObjectFor(typeof(T), mockBehavior); var mock = (Mock <T>)result.MockObject; _ioc.RegisterInstance(mock.Object); _ioc.Resolve <AutoMoqer>().SetMock(typeof(T), mock); return(result); }