Exemplo n.º 1
0
        public void ProductEligibleForSixForThreeWhenCartCountIsSix()
        {
            //Arrange
            ProductCartItem product = new ProductCartItem()
            {
                Id                   = 2,
                ProductName          = "Banana",
                ProductTitle         = "Best Fruit in the world after big mac.",
                ProductImage         = "banana.jpg",
                ProductPrice         = 2,
                CartCount            = 6,
                ProductDiscountOffer = new DiscountOffer()
                {
                    Id = 2, DiscountType = DiscountType.SixForThree
                }
            };

            var sixForThreeStrategy = new SixForThreeDiscountStrategy();

            //Act
            var calculatedPrice = sixForThreeStrategy.CalculateDiscountPrice(product);

            //Assert
            calculatedPrice.Should().Be(6);
        }
Exemplo n.º 2
0
        public void ProductEligibleForSixForThreeWhenCartCountIsSix()
        {
            //Arrange
            ProductCartItem product = new ProductCartItem()
            {
                Id                   = 1,
                ProductName          = "Apple",
                ProductTitle         = "Troublemaker since Adam & Eve.",
                ProductImage         = "apple.jpg",
                ProductPrice         = 1,
                CartCount            = 3,
                ProductDiscountOffer = new DiscountOffer()
                {
                    Id = 1, DiscountType = DiscountType.ThreeForTwo
                }
            };

            var sixForThreeStrategy = new SixForThreeDiscountStrategy();

            //Act
            var calculatedPrice = sixForThreeStrategy.CalculateDiscountPrice(product);

            //Assert
            calculatedPrice.Should().Be(2);
        }