Beispiel #1
0
 public void AddItemTest()
 {
     cart = new Cart();
     cart.AddItem(product, 1);
     Assert.AreEqual(cart.GetItem(product.GetName()).quantity, 1);
     Assert.AreEqual(cart.GetItem(product.GetName()).GetProduct(), product);
     Assert.AreEqual(cart.GetItem(product.GetName()).GetName(), product.GetName());
 }
Beispiel #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);
 }
Beispiel #3
0
 /*
  * Creates a terminal with a new Cart and DataTable of product data
  */
 public Terminal(DataTable data)
 {
     _cart = new Cart();
     _dt = data;
 }
Beispiel #4
0
 public void CalculatePriceDiscountTest2()
 {
     cart = new Cart();
     cart.AddItem(product3, 7);
     Assert.AreEqual(cart.CalculatePrice(), 8.75);
     Assert.AreEqual(cart.CalculateDiscount(), 1.50);
 }