Пример #1
0
        public void Testing_CartItem()
        {
            CartItem cartItem = new CartItem();

            cartItem.AddItem(clothShirt);
            cartItem.AddItem(clothShirt);
            cartItem.AddItem(clothJeans);
            Assert.Equal(1600, cartItem.GetPrice(clothShirt));
        }
Пример #2
0
        public void Testing_Cart_With_Default_10_Discount()
        {
            CartItem cartItem = new CartItem();

            cartItem.AddItem(clothShirt);
            cartItem.AddItem(foodFirstFruit);
            Cart cart = new Cart(cartItem);

            Assert.Equal(765, cart.GetTotal());
        }
Пример #3
0
        public void Testing_Cart_With_No_Discount()
        {
            CartItem cartItem = new CartItem();

            cartItem.AddItem(clothShirt);
            cartItem.AddItem(entertainment);
            Cart cart = new Cart(cartItem, new Discount(null));

            Assert.Equal(1150, cart.GetTotal());
        }
Пример #4
0
        public void Testing_Cart_With_Configured_Discount()
        {
            Discount discount = new Discount(50);
            CartItem cartItem = new CartItem();

            cartItem.AddItem(clothShirt);
            cartItem.AddItem(clothJeans);
            cartItem.AddItem(entertainment);
            cartItem.AddItem(foodFirstFruit);
            Cart cart = new Cart(cartItem, discount);

            Assert.Equal(1200, cart.GetTotal());
        }
Пример #5
0
        public void Check_Total_Price_Without_Discount()
        {
            CartItem cartItem = new CartItem();
            Product  product1 = new Product("Apple", 100);
            Product  product2 = new Product("Banana", 200);

            cartItem.AddItem(product1);
            cartItem.AddItem(product2);

            double expected = 300;
            Cart   cart     = new Cart(cartItem, "");

            Assert.Equal(expected, cart.GetFinal());
        }
Пример #6
0
        public void Add_To_Empty_Cart_test()
        {
            CartItem cartItem = new CartItem();
            Product  product1 = new Product("Apple", 100);
            Product  product2 = new Product("Banana", 200);

            cartItem.AddItem(product1);
            cartItem.AddItem(product2);

            Dictionary <Product, int> dictionaryExpected = new Dictionary <Product, int>()
            {
                { product1, 1 },
                { product2, 1 }
            };

            Assert.Equal(dictionaryExpected, cartItem.ItemList());
        }