private static IExportSettingLogic MakeTestsLogic(bool useAutoFac, ref MockDependents mockDependents) { if (useAutoFac) { ContainerBuilder cb = GetTestsContainer(); // Register mocks MockDependents.RegisterInContainer(ref cb); IContainer testcontainer = cb.Build(); return(testcontainer.Resolve <IExportSettingLogic>()); } mockDependents = new MockDependents(); mockDependents.ExportSettingRepository = MockDependents.MakeIExportSettingRepository(); mockDependents.ExternalCatalogRepository = MockDependents.MakeIExternalCatalogRepository(); mockDependents.UnitOfWork = MockDependents.MakeIUnitOfWork(); var testunit = new ExportSettingLogicImpl(mockDependents.UnitOfWork.Object, mockDependents.ExportSettingRepository.Object, mockDependents.ExternalCatalogRepository.Object); return(testunit); }