Using autofac with moq
问题 I need to register my Autofac container with specific interface, for this case I want to resolved mock. How can I do it? I've tried: var AppContainer = ApplicationContainer.GetApplicationContainer(); var cb = new ContainerBuilder(); cb.RegisterType<Mock<IStudyLoader>>().As<IStudyLoader>().SingleInstance(); cb.Update(AppContainer); I don't want to change my code to resolve something else than IStudyLoader , but Mock<IStudyLoader> is not substitutable for IStudyLoader ; e.g Mock<IStudyLoader>