public void CalcTotPrice() { ShoppingCart SCart = new ShoppingCart(); /* * ////1 copy, 1 book * SCart.AddToShoppingCart(Utils.GetFirstBook(), 1); * Assert.AreEqual<double>(8, Calculator.CalcTotalPrice(SCart)); * SCart.Items.Clear(); * * ////2 copies, 1book * SCart.AddToShoppingCart(Utils.GetFirstBook(), 2); * Assert.AreEqual<double>(16, Calculator.CalcTotalPrice(SCart)); * SCart.Items.Clear(); * * ////5 copies, 1book * SCart.AddToShoppingCart(Utils.GetFirstBook(), 5); * Assert.AreEqual<double>(40, Calculator.CalcTotalPrice(SCart)); * SCart.Items.Clear(); */ ////2 different books SCart.AddToShoppingCart(Utils.GetFirstBook(), 1); SCart.AddToShoppingCart(Utils.GetSecondBook(), 1); Assert.AreEqual <double>(15.2, Calculator.CalcTotalPrice(SCart)); SCart.Items.Clear(); //3 different books SCart.AddToShoppingCart(Utils.GetFirstBook(), 1); SCart.AddToShoppingCart(Utils.GetSecondBook(), 1); SCart.AddToShoppingCart(Utils.GetThirdBook(), 1); Assert.AreEqual <double>(21.6, Calculator.CalcTotalPrice(SCart)); SCart.Items.Clear(); //4 different books SCart.AddToShoppingCart(Utils.GetFirstBook(), 1); SCart.AddToShoppingCart(Utils.GetSecondBook(), 1); SCart.AddToShoppingCart(Utils.GetThirdBook(), 1); SCart.AddToShoppingCart(Utils.GetFourthBook(), 1); Assert.AreEqual <double>(25.6, Calculator.CalcTotalPrice(SCart)); SCart.Items.Clear(); //5 different books SCart.AddToShoppingCart(Utils.GetFirstBook(), 1); SCart.AddToShoppingCart(Utils.GetSecondBook(), 1); SCart.AddToShoppingCart(Utils.GetThirdBook(), 1); SCart.AddToShoppingCart(Utils.GetFourthBook(), 1); SCart.AddToShoppingCart(Utils.GetFifthBook(), 1); Assert.AreEqual <double>(30, Calculator.CalcTotalPrice(SCart)); SCart.Items.Clear(); //5 different books with 2 copies SCart.AddToShoppingCart(Utils.GetFirstBook(), 2); SCart.AddToShoppingCart(Utils.GetSecondBook(), 2); SCart.AddToShoppingCart(Utils.GetThirdBook(), 2); SCart.AddToShoppingCart(Utils.GetFourthBook(), 2); SCart.AddToShoppingCart(Utils.GetFifthBook(), 2); Assert.AreEqual <double>(60, Calculator.CalcTotalPrice(SCart)); SCart.Items.Clear(); //6 different books SCart.AddToShoppingCart(Utils.GetFirstBook(), 2); SCart.AddToShoppingCart(Utils.GetSecondBook(), 1); SCart.AddToShoppingCart(Utils.GetThirdBook(), 1); SCart.AddToShoppingCart(Utils.GetFourthBook(), 1); SCart.AddToShoppingCart(Utils.GetFifthBook(), 1); Assert.AreEqual <double>(38, Calculator.CalcTotalPrice(SCart)); SCart.Items.Clear(); //7 different books SCart.AddToShoppingCart(Utils.GetFirstBook(), 2); SCart.AddToShoppingCart(Utils.GetSecondBook(), 2); SCart.AddToShoppingCart(Utils.GetThirdBook(), 1); SCart.AddToShoppingCart(Utils.GetFourthBook(), 1); SCart.AddToShoppingCart(Utils.GetFifthBook(), 1); Assert.AreEqual <double>(45.2, Calculator.CalcTotalPrice(SCart)); SCart.Items.Clear(); //8 different books SCart.AddToShoppingCart(Utils.GetFirstBook(), 2); SCart.AddToShoppingCart(Utils.GetSecondBook(), 2); SCart.AddToShoppingCart(Utils.GetThirdBook(), 2); SCart.AddToShoppingCart(Utils.GetFourthBook(), 1); SCart.AddToShoppingCart(Utils.GetFifthBook(), 1); Assert.AreEqual <double>(51.2, Calculator.CalcTotalPrice(SCart)); SCart.Items.Clear(); //80 different books SCart.AddToShoppingCart(Utils.GetFirstBook(), 20); SCart.AddToShoppingCart(Utils.GetSecondBook(), 20); SCart.AddToShoppingCart(Utils.GetThirdBook(), 20); SCart.AddToShoppingCart(Utils.GetFourthBook(), 10); SCart.AddToShoppingCart(Utils.GetFifthBook(), 10); Assert.AreEqual <double>(512, Calculator.CalcTotalPrice(SCart)); SCart.Items.Clear(); }