public void FullOrderCost() { UnitTestItems.ClearSelectedIngredients(); Order order = UnitTestItems.GetSimulatedOrderItem(); int result = order.Total; int expected = UnitTestItems.SimulatedOrderItemCost; Assert.AreEqual(expected, result); UnitTestItems.ClearSelectedIngredients(); }
public void SimulateCompleteOrder() { UnitTestItems.ClearSelectedIngredients(); Order order = UnitTestItems.GetSimulatedOrderItem(); order.SaveOrder(); //Check order was saved Order retrievedOrder = new Order(order.OrderId); //Finds order in data store Assert.AreEqual(order.OrderId, retrievedOrder.OrderId); Assert.AreEqual(UnitTestItems.SimulatedOrderItemCost, retrievedOrder.Total); }
public void TestSubtotals() { UnitTestItems.ClearSelectedIngredients(); Order order = UnitTestItems.GetSimulatedOrderItem(); List <SubTotal> subtotals = order.GetSubTotals(); //Subtotals should return as below. Ingredient items are ordered by price high to low // Item[0] (nacho bowl) // Base Price: 399 // Chicken, Amount 1, Cost 0 // Red Salsa, Amount 1, Cost 0 // // Item[1] (3 item nacho) // Base Price: 599 // Queso, Amount 1, Cost 150 // Chicken, Amount 1, Cost 0 // Grated Cheese, Amount 1, Cost 0 // // Item[2] (a-la-carte) // Base Price 599 // Steak, Amount 2, Cost 50 // Red Salsa, Amount 1, Cost 33 // Grated Cheese, Amount 1, Cost 33 // Queso, Amount 1, Cost 0 // Guacamole, Amount 1, Cost 0 // // Item[3] (chips) // Base Price: 200 // // Item[4] (cola) // Base Price: 125 Assert.AreEqual(5, subtotals.Count); Assert.AreEqual(399, subtotals[0].BasePrice); Assert.AreEqual(599, subtotals[1].BasePrice); Assert.AreEqual(599, subtotals[2].BasePrice); Assert.AreEqual(200, subtotals[3].BasePrice); Assert.AreEqual(125, subtotals[4].BasePrice); Assert.AreEqual(2, subtotals[0].SelectedIngredientsInfo.Count); Assert.AreEqual(3, subtotals[1].SelectedIngredientsInfo.Count); Assert.AreEqual(749, subtotals[1].ItemTotal); Assert.AreEqual(150, subtotals[1].SelectedIngredientsInfo[0].Cost); Assert.AreEqual(2, subtotals[2].SelectedIngredientsInfo[0].Amount); Assert.AreEqual(1, subtotals[2].SelectedIngredientsInfo[1].Amount); Assert.AreEqual(1, subtotals[2].SelectedIngredientsInfo[2].Amount); Assert.AreEqual(1, subtotals[2].SelectedIngredientsInfo[3].Amount); Assert.AreEqual(1, subtotals[2].SelectedIngredientsInfo[4].Amount); Assert.AreEqual(50, subtotals[2].SelectedIngredientsInfo[0].Cost); Assert.AreEqual(50, subtotals[2].SelectedIngredientsInfo[1].Cost); Assert.AreEqual(33, subtotals[2].SelectedIngredientsInfo[2].Cost); Assert.AreEqual(0, subtotals[2].SelectedIngredientsInfo[3].Cost); Assert.AreEqual(0, subtotals[2].SelectedIngredientsInfo[4].Cost); UnitTestItems.ClearSelectedIngredients(); }