My unit test wants to test an instance of IBusinessService using a mock object for IContractDataService.
does not seem to make a difference as a proper instance of IContractDataService is getting created regardless.
The same goes for the code provided here ...
I have got the functionality I was after by making a slight modification to the code you provided.
return (AutoMockingUnityContainer) this.RegisterType(typeof(T), null, null, new MockFactory(typeof(T),mocks,Lifetime.Singleton));
return (AutoMockingUnityContainer) this.RegisterType(typeof(T), typeof(T), null, new MockFactory(typeof(T),mocks,Lifetime.Singleton));
when I call WillCreateMockFor() after I have already called RegisterType() for the same T, the original registration is now "overwritten". Looks like this does not happen when you pass "null" so passing "typeof(T)" has done the trick.
What is the advantage of using unity over Rhino Mocks. I am pretty new to these technologies. Please throw some light on this subject.
look here for a similar discussion and answers
Your container includes MockRepository but does not define it. What is the definition for MockRepository in your code?