How to use Unity.RegisterType with Moq?
问题 I have a running code with unity. Now I want to use Moq to do my unit testing for ASP-MVC. In the global.asax's code, I have the following: IUnityContainer container = new UnityContainer(); container.RegisterType<IFoo, Foo>(new InjectionConstructor("xxx")); Now I wrote testcode with Moq: IUnityContainer container = new UnityContainer(); var mockFoo = new Mock<IFoo>(); container.RegisterType<IFoo, mockFoo) >(new InjectionConstructor("xxx")); but this don't work. Error: The type 'Moq.Mock'