public void Testing_CartItem() { CartItem cartItem = new CartItem(); cartItem.AddItem(clothShirt); cartItem.AddItem(clothShirt); cartItem.AddItem(clothJeans); Assert.Equal(1600, cartItem.GetPrice(clothShirt)); }
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()); }
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()); }
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()); }
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()); }
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()); }