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;
 }
Example #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);
        }
Example #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;
 }
Example #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);
        }
Example #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);
        }
Example #6
0
        public ProductController()
        {
            var alltOchMerDataContext = new AlltOchMerDataContext("AlltOchMerDbConnectionString");

            this.productListRepository = new ProductListRepository(alltOchMerDataContext);
            this.productRepository     = new ProductRepository(alltOchMerDataContext);
        }
Example #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;
 }
Example #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);
     };
 }
Example #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);
        }
Example #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);
        }
 public ProductListUpdateCommandHandler(IProductListRepository productListRepository)
 {
     this.productListRepository = productListRepository ?? throw new ArgumentNullException(nameof(productListRepository));
 }
 public ProductListService(IProductListRepository productListRepository, IStoreService storeService)
 {
     _productListRepository = productListRepository;
     _storeService          = storeService;
 }
 public DeleteProductListCommandHandler(IProductListRepository productLists)
 {
     this.productLists = productLists ?? throw new ArgumentNullException(nameof(productLists));
 }
Example #14
0
 public ProductController(IProductListRepository productListRepository, IProductRepository productRepository)
 {
     this.productListRepository = productListRepository;
     this.productRepository     = productRepository;
 }
Example #15
0
 public BasketService(IOfferService offerService, IProductListRepository productRepository)
 {
     _offerService      = offerService;
     _productRepository = productRepository;
 }