コード例 #1
0
 public ARCatalogController(IModelProvider modelProvider,
                            IProductListHeaderRepository productListHeaderRepository,
                            IProductListRepository productListRepository,
                            IPromotedProductsRepository promotedProductsRepository,
                            IProductInformationRepository productInformationRepository,
                            IProductImagesRepository productImagesRepository,
                            IProductInventoryRepository productInventoryRepository,
                            IProductPriceRepository productPriceRepository,
                            IProductVariantsRepository productVariantsRepository,
                            IProductListPagerRepository productListPagerRepository,
                            IProductFacetsRepository productFacetsRepository,
                            IProductListSortingRepository productListSortingRepository,
                            IProductListPageInfoRepository productListPageInfoRepository,
                            IProductListItemsPerPageRepository productListItemsPerPageRepository,
                            ICatalogItemContainerRepository catalogItemContainerRepository,
                            IVisitedCategoryPageRepository visitedCategoryPageRepository,
                            IVisitedProductDetailsPageRepository visitedProductDetailsPageRepository,
                            ISearchInitiatedRepository searchInitiatedRepository,
                            IStorefrontContext storefrontContext,
                            ISiteContext siteContext,
                            IContext sitecoreContext,
                            IARCatalogRepository arRepository) : base(modelProvider, productListHeaderRepository,
                                                                      productListRepository, promotedProductsRepository, productInformationRepository,
                                                                      productImagesRepository, productInventoryRepository, productPriceRepository,
                                                                      productVariantsRepository, productListPagerRepository, productFacetsRepository,
                                                                      productListSortingRepository, productListPageInfoRepository,
                                                                      productListItemsPerPageRepository, catalogItemContainerRepository,
                                                                      visitedCategoryPageRepository, visitedProductDetailsPageRepository,
                                                                      searchInitiatedRepository, storefrontContext, siteContext, sitecoreContext)
 {
     _arRepository = arRepository;
 }
コード例 #2
0
        public void Given_OneBread_WhenGetCurrentBasket_ReturnBasketWithOneBreadWithEightyPenceTotalPrice()
        {
            Mock <IProductListRepository> mockProductRepository = new Mock <IProductListRepository>();

            mockProductRepository.Setup(m => m.GetProductListForId("1")).Returns(new ProductListDto {
                Id = "1", Products = new List <ProductDto>
                {
                    new ProductDto
                    {
                        PriceInPounds = 1.00m,
                        DisplayName   = "Bread",
                        Quantity      = 1,
                        Id            = Product.BreadId
                    }
                }
            });
            IProductListRepository mocked  = mockProductRepository.Object;
            BasketService          service = new BasketService(_offerService, mocked);

            var result = service.GetCurrentBasket("1");

            Assert.IsNotNull(result);
            Assert.AreEqual(1.00m, result.TotalPriceInPounds);
            Assert.AreEqual(1, result.Products.Count);
            Assert.AreEqual(Product.BreadId, result.Products[0].Id);
        }
コード例 #3
0
 public PurchasableProductListController(IModelProvider modelProvider, IProductListHeaderRepository productListHeaderRepository,
                                         IProductListRepository productListRepository, IPromotedProductsRepository promotedProductsRepository,
                                         IProductInformationRepository productInformationRepository,
                                         IProductImagesRepository productImagesRepository, IProductInventoryRepository productInventoryRepository,
                                         IProductPriceRepository productPriceRepository, IProductVariantsRepository productVariantsRepository,
                                         IProductListPagerRepository productListPagerRepository, IProductFacetsRepository productFacetsRepository,
                                         IProductListSortingRepository productListSortingRepository,
                                         IProductListPageInfoRepository productListPageInfoRepository,
                                         IProductListItemsPerPageRepository productListItemsPerPageRepository,
                                         ICatalogItemContainerRepository catalogItemContainerRepository,
                                         ICartManager cartManager, IVisitorContext visitorContext,
                                         IVisitedCategoryPageRepository visitedCategoryPageRepository, IVisitedProductDetailsPageRepository visitedProductDetailsPageRepository,
                                         ISearchInitiatedRepository searchInitiatedRepository, IStorefrontContext storefrontContext,
                                         ISiteContext siteContext, IContext context, IPurchasableProductListRepository purchasableProductListRepository)
     : base(modelProvider, productListHeaderRepository, productListRepository, promotedProductsRepository,
            productInformationRepository, productImagesRepository, productInventoryRepository, productPriceRepository,
            productVariantsRepository, productListPagerRepository, productFacetsRepository, productListSortingRepository,
            productListPageInfoRepository, productListItemsPerPageRepository, catalogItemContainerRepository,
            visitedCategoryPageRepository, visitedProductDetailsPageRepository, searchInitiatedRepository,
            storefrontContext, siteContext, context)
 {
     _cartManager    = cartManager;
     _visitorContext = visitorContext;
     _purchasableProductListRepository = purchasableProductListRepository;
 }
コード例 #4
0
        public void Given_FourMilk_WhenGetCurrentBasket_ReturnBasketWithThreePoundsFortyFivePenceTotalPrice()
        {
            Mock <IProductListRepository> mockProductRepository = new Mock <IProductListRepository>();

            mockProductRepository.Setup(m => m.GetProductListForId("1")).Returns(new ProductListDto
            {
                Id       = "1",
                Products = new List <ProductDto>
                {
                    new ProductDto
                    {
                        PriceInPounds = 1.15m,
                        DisplayName   = "Milk",
                        Quantity      = 4,
                        Id            = Product.MilkId
                    }
                }
            });
            IProductListRepository mocked  = mockProductRepository.Object;
            BasketService          service = new BasketService(_offerService, mocked);

            var result = service.GetCurrentBasket("1");

            Assert.IsNotNull(result);
            Assert.AreEqual(3.45m, result.TotalPriceInPounds);
        }
コード例 #5
0
        public void Given_TwoBreadTwoButter_WhenGetCurrentBasket_ReturnBasketWithThreePoundsTenPenceTotalPrice()
        {
            Mock <IProductListRepository> mockProductRepository = new Mock <IProductListRepository>();

            mockProductRepository.Setup(m => m.GetProductListForId("1")).Returns(new ProductListDto
            {
                Id       = "1",
                Products = new List <ProductDto>
                {
                    new ProductDto
                    {
                        PriceInPounds = 1.00m,
                        DisplayName   = "Bread",
                        Quantity      = 2,
                        Id            = Product.BreadId
                    },
                    new ProductDto
                    {
                        PriceInPounds = 0.80m,
                        DisplayName   = "Butter",
                        Quantity      = 2,
                        Id            = Product.ButterId
                    },
                }
            });
            IProductListRepository mocked  = mockProductRepository.Object;
            BasketService          service = new BasketService(_offerService, mocked);

            var result = service.GetCurrentBasket("1");

            Assert.IsNotNull(result);
            Assert.AreEqual(3.10m, result.TotalPriceInPounds);
        }
コード例 #6
0
        public ProductController()
        {
            var alltOchMerDataContext = new AlltOchMerDataContext("AlltOchMerDbConnectionString");

            this.productListRepository = new ProductListRepository(alltOchMerDataContext);
            this.productRepository     = new ProductRepository(alltOchMerDataContext);
        }
コード例 #7
0
 public ProductController(ISitecoreContext sitecoreContext, IStorefrontContext storefrontContext, IVisitorContext visitorContext, ICatalogRepository catalogRepository, IProductListRepository productListRepository)
 {
     this.sitecoreContext       = sitecoreContext;
     this.storefrontContext     = storefrontContext;
     this.visitorContext        = visitorContext;
     this.catalogRepository     = catalogRepository;
     this.productListRepository = productListRepository;
 }
コード例 #8
0
 public ProductList(ILog logger, IProductListRepository repository) : base("/ProductList")
 {
     Get["/Page/{page:int}/"] = parameters =>
     {
         logger.Info("Geetting ProductList");
         logger.Debug(string.Format("Page {0}", parameters.page));
         IEnumerable <Product> products = repository.GetPagedItem(parameters.page, 10);
         logger.Info("End ProductList");
         return(products);
     };
 }
コード例 #9
0
        public void Given_NoProducts_WhenGetCurrentBasket_ReturnEmptyBasketWithZeroTotalPrice()
        {
            Mock <IProductListRepository> mockProductRepository = new Mock <IProductListRepository>();

            mockProductRepository.Setup(m => m.GetProductListForId("1")).Returns(new ProductListDto {
                Id = "1", Products = new List <ProductDto>()
            });
            IProductListRepository mocked  = mockProductRepository.Object;
            BasketService          service = new BasketService(_offerService, mocked);

            var result = service.GetCurrentBasket("1");

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.TotalPriceInPounds);
            Assert.AreEqual(0, result.Products.Count);
        }
コード例 #10
0
        public void Given_OneBreadOneButterOneMilk_WhenGetCurrentBasket_ReturnBasketWithTwoPoundsNinetyFivePenceTotalPrice()
        {
            Mock <IProductListRepository> mockProductRepository = new Mock <IProductListRepository>();

            mockProductRepository.Setup(m => m.GetProductListForId("1")).Returns(new ProductListDto
            {
                Id       = "1",
                Products = new List <ProductDto>
                {
                    new ProductDto
                    {
                        PriceInPounds = 1.00m,
                        DisplayName   = "Bread",
                        Quantity      = 1,
                        Id            = "1"
                    },
                    new ProductDto
                    {
                        PriceInPounds = 0.80m,
                        DisplayName   = "Butter",
                        Quantity      = 1,
                        Id            = "2"
                    },
                    new ProductDto
                    {
                        PriceInPounds = 1.15m,
                        DisplayName   = "Milk",
                        Quantity      = 1,
                        Id            = "3"
                    }
                }
            });
            IProductListRepository mocked  = mockProductRepository.Object;
            BasketService          service = new BasketService(_offerService, mocked);


            var result = service.GetCurrentBasket("1");

            Assert.IsNotNull(result);
            Assert.AreEqual(2.95m, result.TotalPriceInPounds);
        }
コード例 #11
0
 public ProductListUpdateCommandHandler(IProductListRepository productListRepository)
 {
     this.productListRepository = productListRepository ?? throw new ArgumentNullException(nameof(productListRepository));
 }
コード例 #12
0
 public ProductListService(IProductListRepository productListRepository, IStoreService storeService)
 {
     _productListRepository = productListRepository;
     _storeService          = storeService;
 }
コード例 #13
0
 public DeleteProductListCommandHandler(IProductListRepository productLists)
 {
     this.productLists = productLists ?? throw new ArgumentNullException(nameof(productLists));
 }
コード例 #14
0
 public ProductController(IProductListRepository productListRepository, IProductRepository productRepository)
 {
     this.productListRepository = productListRepository;
     this.productRepository     = productRepository;
 }
コード例 #15
0
 public BasketService(IOfferService offerService, IProductListRepository productRepository)
 {
     _offerService      = offerService;
     _productRepository = productRepository;
 }