public void Test_Buy_Book1x1() { var shoppingCart = new ShoppingCart(); shoppingCart.Items.Add(new ShoppingItem() { BookType = 1, Num = 1, UnitPrice = 100 }); shoppingCart.CalTotalPrice(); Assert.AreEqual(shoppingCart.TotalPrice, 100); }
public void Test_Buy_Book1x1_Book2x1_Book3x1_Book4x1_Book5x1() { var shoppingCart = new ShoppingCart(); shoppingCart.Items.Add(new ShoppingItem() { BookType = 1, Num = 1, UnitPrice = 100 }); shoppingCart.Items.Add(new ShoppingItem() { BookType = 2, Num = 1, UnitPrice = 100 }); shoppingCart.Items.Add(new ShoppingItem() { BookType = 3, Num = 1, UnitPrice = 100 }); shoppingCart.Items.Add(new ShoppingItem() { BookType = 4, Num = 1, UnitPrice = 100 }); shoppingCart.Items.Add(new ShoppingItem() { BookType = 5, Num = 1, UnitPrice = 100 }); shoppingCart.CalTotalPrice(); Assert.AreEqual(shoppingCart.TotalPrice, 375); }