private static IExportInvoicesService MakeTestsService(bool useAutoFac, ref MockDependents mockDependents) { if (useAutoFac) { ContainerBuilder cb = GetTestsContainer(); // Register mocks MockDependents.RegisterInContainer(ref cb); var testcontainer = cb.Build(); return(testcontainer.Resolve <IExportInvoicesService>()); } else { mockDependents = new MockDependents(); mockDependents.IExportSettingLogic = MockDependents.MakeIExportSettingLogic(); mockDependents.ICustomerRepository = MockDependents.MakeICustomerRepository(); mockDependents.IOrderLogic = MockDependents.MakeIOrderLogic(); mockDependents.IOnlinePaymentsLogic = MockDependents.MakeIOnlinePaymentsLogic(); mockDependents.IKPayInvoiceRepository = MockDependents.MakeIKPayInvoiceRepository(); var testunit = new ExportInvoicesServiceImpl(mockDependents.IExportSettingLogic.Object, mockDependents.IOrderLogic.Object, mockDependents.IOnlinePaymentsLogic.Object, mockDependents.IKPayInvoiceRepository.Object, mockDependents.ICustomerRepository.Object); return(testunit); } }