public void CategoryDiscount_ProductDiscountDisabled()
        {
            //Arrange
            Brand    brand    = new Brand(1, "b1");
            Category category = new Category(1, "c1");
            Product  p1       = new Product("p1", 800, 700, brand, category);

            Brand    brand2    = new Brand(2, "b2");
            Category category2 = new Category(2, "c2");
            Product  p2        = new Product("p2", 400, 250, brand2, category2);
            User     u         = new User("user", MemberShipTypeEnum.GOLD);

            Basket = new Basket(u, DateTime.Now);
            Basket.AddOrderProduct(new BasketProduct(p1, 1));
            Basket.AddOrderProduct(new BasketProduct(p2, 1));

            Dictionary <int, Double> categoryDiscounts = new Dictionary <int, double> {
                { 1, 0.1 }, { 3, 0.15 }
            };
            DiscountBase productDiscountStrategy    = new ProductDiscount(false);
            DiscountBase categoryDiscountStrategy   = new CategoryDiscount(categoryDiscounts, productDiscountStrategy);
            DiscountBase memberShipDiscountStrategy = new BasketDiscountGoldUser(categoryDiscountStrategy);
            double       discountedPrice            = Basket.calcDiscountedTotal(memberShipDiscountStrategy);

            //Act
            //800+400 =1200 total after product discount
            //1200 - 80 = 1120 total after category discount
            //1120 - 112 = 783 total after gold membership discount
            discountedPrice.Should().Be(1008);
        }
        public void BlackFriday40PercentTest()
        {
            //Arrange
            User    u      = new User("user", MemberShipTypeEnum.STANDART);
            Basket  basket = new Basket(u, new DateTime(2019, 11, 29));
            Product p1     = new Product("p1", 700, 650);
            Product p2     = new Product("p2", 500, 400);

            basket.AddOrderProduct(new BasketProduct(p1, 1));
            basket.AddOrderProduct(new BasketProduct(p2, 1));
            //Act
            DiscountBase discountStrategy = StandartDiscountFactory.Instance.GetDiscountStrategy(basket);
            double       discountedPrice  = basket.calcDiscountedTotal(discountStrategy);

            //Assert
            discountedPrice.Should().Be(720);
        }
        public void BasketDiscount15PercentTest()
        {
            //Arrange
            User    u      = new User("user", MemberShipTypeEnum.STANDART);
            Basket  basket = new Basket(u, DateTime.Now);
            Product p1     = new Product("p1", 100, 90);
            Product p2     = new Product("p2", 200, 180);

            basket.AddOrderProduct(new BasketProduct(p1, 1));
            basket.AddOrderProduct(new BasketProduct(p2, 1));
            //Act
            DiscountBase discountStrategy = StandartDiscountFactory.Instance.GetDiscountStrategy(basket);
            double       discountedPrice  = basket.calcDiscountedTotal(discountStrategy);

            //Assert
            discountedPrice.Should().Be(255);
        }
        public void BasketDiscountOverGoldMemberShipType()
        {
            //Arrange
            Product p1 = new Product("p1", 800, 700);
            Product p2 = new Product("p2", 400, 250);
            User    u  = new User("user", MemberShipTypeEnum.GOLD);

            Basket = new Basket(u, DateTime.Now);
            Basket.AddOrderProduct(new BasketProduct(p1, 1));
            Basket.AddOrderProduct(new BasketProduct(p2, 1));
            //Act
            DiscountBase productDiscountStrategy    = new ProductDiscount();
            DiscountBase memberShipDiscountStrategy = new BasketDiscountGoldUser(productDiscountStrategy);
            double       discountedPrice            = Basket.calcDiscountedTotal(memberShipDiscountStrategy);

            //Assert
            discountedPrice.Should().Be(855);
        }
        public void BasketTotalNoDiscount()
        {
            //Arrange
            Product p1 = new Product("p1", 100, 100);
            Product p2 = new Product("p2", 200, 100);

            Basket.AddOrderProduct(new BasketProduct(p1, 1));
            Basket.AddOrderProduct(new BasketProduct(p2, 1));
            //Act
            DiscountBase discountStrategy = new NoDiscount();
            double       discountedPrice  = Basket.calcDiscountedTotal(discountStrategy);

            //Assert
            discountedPrice.Should().Be(300);
        }