コード例 #1
0
        private static IImportLogic MakeTestsLogic(bool useAutoFac, ref MockDependents mockDependents)
        {
            if (useAutoFac)
            {
                ContainerBuilder cb = GetTestsContainer();

                // Register mocks
                MockDependents.RegisterInContainer(ref cb);

                IContainer testcontainer = cb.Build();

                return(testcontainer.Resolve <IImportLogic>());
            }
            mockDependents = new MockDependents();
            mockDependents.CatalogLogic                   = MockDependents.MakeICatalogLogic();
            mockDependents.EventLogRepository             = MockDependents.MakeIEventLogRepository();
            mockDependents.ShoppingCartLogic              = MockDependents.MakeIShoppingCartLogic();
            mockDependents.PriceLogic                     = MockDependents.MakeIPriceLogic();
            mockDependents.CustomInventoryItemsRepository = MockDependents.MakeICustomInventoryItemsRepository();
            mockDependents.SiteCatalogService             = MockDependents.MakeISiteCatalogService();

            ImportLogicImpl testunit = new ImportLogicImpl(mockDependents.CatalogLogic.Object, mockDependents.EventLogRepository.Object, mockDependents.ShoppingCartLogic.Object,
                                                           mockDependents.PriceLogic.Object, mockDependents.CustomInventoryItemsRepository.Object, mockDependents.SiteCatalogService.Object);

            return(testunit);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        private static IUserProfileRepository MakeTestsLogic(bool useAutoFac, ref MockDependents mockDependents)
        {
            if (useAutoFac)
            {
                ContainerBuilder cb = GetTestsContainer();

                // Register mocks
                MockDependents.RegisterInContainer(ref cb);

                IContainer testcontainer = cb.Build();

                return(testcontainer.Resolve <IUserProfileRepository>());
            }
            mockDependents = new MockDependents();
            mockDependents.IEventLogRepository = MockDependents.MakeIEventLogRepository();
            mockDependents.IAuditLogRepository = MockDependents.MakeIAuditLogRepository();

            UserProfileRepository testunit = new UserProfileRepository(mockDependents.IEventLogRepository.Object, mockDependents.IAuditLogRepository.Object);

            return(testunit);
        }
コード例 #5
0
        private static IReportLogic MakeTestsLogic(bool useAutoFac, ref MockDependents mockDependents)
        {
            if (useAutoFac)
            {
                ContainerBuilder cb = GetTestsContainer();

                // Register mocks
                MockDependents.RegisterInContainer(ref cb);

                IContainer testcontainer = cb.Build();

                return(testcontainer.Resolve <IReportLogic>());
            }
            mockDependents = new MockDependents();
            mockDependents.ICatalogLogic       = MockDependents.MakeICatalogLogic();
            mockDependents.ICatalogRepository  = MockDependents.MakeICatalogRepository();
            mockDependents.IReportRepository   = MockDependents.MakeIReportRepository();
            mockDependents.IEventLogRepository = MockDependents.MakeIEventLogRepository();

            ReportLogic testunit = new ReportLogic(mockDependents.ICatalogRepository.Object, mockDependents.IReportRepository.Object, mockDependents.IEventLogRepository.Object,
                                                   mockDependents.ICatalogLogic.Object);

            return(testunit);
        }