Override Autofac registration - Integration tests with DI
问题 I write integration tests for my application, and use my container for this. I want to be able to register all the components as I do in real running, and then override some of the components and switch them to use stubs implementations. I wouldn't want to seperate the DI and have a container for tests only because I want to test the real thing. Doing this also seems ugly: public class MyRegistrations { public static RegisterAll(bool isInTest= false) { if (isTest) { // Register test fakes }