private static IOnlinePaymentsLogic MakeTestsLogic(bool useAutoFac, ref MockDependents mockDependents) { if (useAutoFac) { ContainerBuilder cb = GetTestsContainer(); // Register mocks MockDependents.RegisterInContainer(ref cb); IContainer testcontainer = cb.Build(); return(testcontainer.Resolve <IOnlinePaymentsLogic>()); } mockDependents = new MockDependents(); mockDependents.ICacheRepository = MockDependents.MakeICacheRepository(); mockDependents.IAuditLogRepository = MockDependents.MakeIAuditLogRepository(); mockDependents.ICustomerBankRepository = MockDependents.MakeICustomerBankRepository(); mockDependents.ICustomerRepository = MockDependents.MakeICustomerRepository(); mockDependents.IEventLogRepository = MockDependents.MakeIEventLogRepository(); mockDependents.IGenericQueueRepository = MockDependents.MakeIGenericQueueRepository(); mockDependents.IInternalUserAccessRepository = MockDependents.MakeIInternalUserAccessRepository(); mockDependents.IKPayInvoiceRepository = MockDependents.MakeIKPayInvoiceRepository(); mockDependents.IKPayLogRepository = MockDependents.MakeIKPayLogRepository(); mockDependents.IKPayPaymentTransactionRepository = MockDependents.MakeIKPayPaymentTransactionRepository(); mockDependents.IOrderHistoryHeaderRepsitory = MockDependents.MakeIOrderHistoryHeaderRepsitory(); OnlinePaymentLogicImpl testunit = new OnlinePaymentLogicImpl(mockDependents.IKPayInvoiceRepository.Object, mockDependents.ICustomerBankRepository.Object, mockDependents.IOrderHistoryHeaderRepsitory.Object, mockDependents.ICustomerRepository.Object, mockDependents.IGenericQueueRepository.Object, mockDependents.IKPayPaymentTransactionRepository.Object, mockDependents.IKPayLogRepository.Object, mockDependents.IAuditLogRepository.Object, mockDependents.IEventLogRepository.Object, mockDependents.IInternalUserAccessRepository.Object, mockDependents.ICacheRepository.Object); return(testunit); }