private static IOrderLogic MakeTestsLogic(bool useAutoFac, ref MockDependents mockDependents) { if (useAutoFac) { ContainerBuilder cb = GetTestsContainer(); // Register mocks MockDependents.RegisterInContainer(ref cb); IContainer testcontainer = cb.Build(); return(testcontainer.Resolve <IOrderLogic>()); } mockDependents = new MockDependents(); mockDependents.ICacheRepository = MockDependents.MakeICacheRepository(); mockDependents.ICatalogLogic = MockDependents.MakeICatalogLogic(); mockDependents.INoteLogic = MockDependents.MakeINoteLogic(); mockDependents.ICustomerRepository = MockDependents.MakeICustomerRepository(); mockDependents.IEventLogRepository = MockDependents.MakeIEventLogRepository(); mockDependents.IOrderQueueLogic = MockDependents.MakeIOrderQueueLogic(); mockDependents.IOrderedFromListRepository = MockDependents.MakeIOrderedFromListRepository(); mockDependents.IKPayInvoiceRepository = MockDependents.MakeIKPayInvoiceRepository(); mockDependents.IPriceLogic = MockDependents.MakeIPriceLogic(); mockDependents.IPurchaseOrderRepository = MockDependents.MakeIPurchaseOrderRepository(); mockDependents.IOrderHistoryHeaderRepsitory = MockDependents.MakeIOrderHistoryHeaderRepsitory(); mockDependents.IShipDateRepository = MockDependents.MakeIShipDateRepository(); OrderLogicImpl testunit = new OrderLogicImpl(mockDependents.IPurchaseOrderRepository.Object, mockDependents.ICatalogLogic.Object, mockDependents.INoteLogic.Object, mockDependents.ICacheRepository.Object, mockDependents.IOrderQueueLogic.Object, mockDependents.IPriceLogic.Object, mockDependents.IEventLogRepository.Object, mockDependents.IShipDateRepository.Object, mockDependents.ICustomerRepository.Object, mockDependents.IOrderHistoryHeaderRepsitory.Object, mockDependents.IKPayInvoiceRepository.Object, mockDependents.IOrderedFromListRepository.Object, null, null); return(testunit); }