コード例 #1
0
        public void Test_Verify_BasketTotal_After_Calling_BogofOfferProcessor_For_Basket1()
        {
            // Arrange
            var shoppingBasket = new BLL.ShoppingBasket
            {
                BogofOffers = new List <BogofOffer>
                {
                    _bogoOfferRepository.GetBogofOffer(3)
                }
            };

            shoppingBasket.AddtemToBasket(_productRepository.GetProduct(7));
            shoppingBasket.AddtemToBasket(_productRepository.GetProduct(2));

            // Act
            var basketProcessor = new BogofOfferProcessor();

            shoppingBasket.Total = 65.15m;
            basketProcessor.Process(shoppingBasket);

            // Assert
            Assert.AreEqual(65.15m, shoppingBasket.Total);
        }
コード例 #2
0
        public void Test_Basket1()
        {
            // Arrage
            var shoppingBasket = new BLL.ShoppingBasket
            {
                BogofOffers = new List <BogofOffer>
                {
                    _bogoOfferRepository.GetBogofOffer(1)
                }
            };

            shoppingBasket.AddtemToBasket(_productRepository.GetProduct(1));
            shoppingBasket.AddtemToBasket(_productRepository.GetProduct(2));

            var basketService = new BasketService(_basketProcessorFactory);

            // Act
            var basketServiceResponse = basketService.GetBasketTotal(shoppingBasket);

            // Assert
            Assert.AreEqual(65.15, basketServiceResponse.BasketTotal);
            Assert.AreEqual(0, basketServiceResponse.Notifications.Count);
        }