예제 #1
0
        public static void UnitTest()
        {
            CurrentContainer = new IoCContainer();
            IO.Container     = CurrentContainer;
            SettingsService.InclVat();
            VatCalculationStrategy.OverParts();

            Logger.Mock();

            UwebshopConfiguration.UseType <UwebshopConfiguration>();            // todo no UseType? (slow)
            UwebshopRequestService.Use(MockConstructors.CreateMockUwebshopRequestService());

            OrderDiscountRepository.SetupFake();
            CategoryService.Use(MockConstructors.CreateMockEntityService <ICategoryService, Category>());
            ProductVariantService.Use(MockConstructors.CreateMockEntityService <IProductVariantService, ProductVariant>());
            CouponCodeService.Mock();

            StoreRepository.Use(new TestStoreRepository());
            CMSEntityRepository.Use(new TestCMSEntityRepository());
            CountryRepository.Use(new TestCountryRepository());
            VATCountryRepository.Use(new TestVATCountryRepository());
            OrderRepository.Mock();
            ProductDiscountRepository.Mock();
            ProductRepository.Mock();
            ProductVariantGroupRepository.Mock();
            CategoryRepository.Mock();
            ProductVariantRepository.Mock();

            CMSApplication.Use(new StubCMSApplicationNotInBackend());
            HttpContextWrapper.Mock();

            DiscountService.UseType <FakeDiscountService>();

            StoreService.Use(new TestStoreService());
            OrderService.Use(new TestOrderService());
            ProductService.Use(new TestProductService());
            CMSDocumentTypeService.Use(new StubCMSDocumentTypeService());

            OrderUpdatingService.Mock();
            OrderNumberService.Mock();
            CatalogUrlResolvingService.Mock();
            PaymentProviderService.Mock();
            StoreFromUrlDeterminationService.Mock();
            StockService.Mock();
            ApplicationCacheService.Mock();

            UwebshopRequestService.Use(new StubUwebshopRequestService());

            CurrentContainer.SetDefaultServiceFactory(new MockServiceFactory());

            ModuleFunctionality.Register(CurrentContainer);
            CurrentContainer.RegisterType <IContentTypeAliassesXmlService, StubContentTypeAliassesXmlService>();
            CurrentContainer.RegisterType <IProductVariantGroupService, ProductVariantGroupService>();

            InitializeServiceLocators();
        }