Пример #1
0
 public void AddExistingItemTest()
 {
     cart = new Cart();
     cart.AddItem(product, 1);
     cart.AddItem(product, 1);
     Assert.AreEqual(cart.GetItem(product.GetName()).quantity, 2);
     Assert.AreEqual(cart.GetItem(product.GetName()).GetProduct(), product);
     Assert.AreEqual(cart.GetItem(product.GetName()).GetName(), product.GetName());
 }
Пример #2
0
 public void CalculatePriceDiscountTest1()
 {
     cart = new Cart();
     cart.AddItem(product, 4);
     cart.AddItem(product2, 2);
     cart.AddItem(product3, 1);
     cart.AddItem(product4, 1);
     Assert.AreEqual(cart.CalculatePrice(), 33.40);
     Assert.AreEqual(cart.CalculateDiscount(), 1.00);
 }
Пример #3
0
 public void AddMultipleItemsTest()
 {
     cart = new Cart();
     cart.AddItem(product, 1);
     cart.AddItem(product2, 1);
     Assert.AreEqual(cart.GetItem(product.GetName()).quantity, 1);
     Assert.AreEqual(cart.GetItem(product2.GetName()).quantity, 1);
     Assert.AreEqual(cart.GetItem(product.GetName()).GetProduct(), product);
     Assert.AreEqual(cart.GetItem(product2.GetName()).GetProduct(), product2);
     Assert.AreEqual(cart.GetItem(product.GetName()).GetName(), product.GetName());
     Assert.AreEqual(cart.GetItem(product2.GetName()).GetName(), product2.GetName());
 }
Пример #4
0
 public void CalculatePriceDiscountTest2()
 {
     cart = new Cart();
     cart.AddItem(product3, 7);
     Assert.AreEqual(cart.CalculatePrice(), 8.75);
     Assert.AreEqual(cart.CalculateDiscount(), 1.50);
 }