public void IsOrdersCompletedTest() { DrinkModel model = new DrinkModel(); for (int i = 0; i < 5; i++) { model.AddDrinkToCurrentOrders(i); } model.DeleteDrinkFromCurrentOrders(-1); for (int i = 0; i < 6; i++) { model.SetSweetLevel(i, "微糖"); } Assert.AreEqual(model.IsOrdersCompleted(), false); model.DeleteDrinkFromCurrentOrders(-1); model.DeleteDrinkFromCurrentOrders(11); for (int i = 0; i < 6; i++) { model.SetTemperature(i, "少冰"); } Assert.AreEqual(model.IsOrdersCompleted(), true); model.DeleteDrinkFromCurrentOrders(0); model.DeleteDrinkFromCurrentOrders(2); Assert.AreEqual(model.GetOrdersSize(), 3); model.AddDrinkToCurrentOrders(4); Assert.AreEqual(model.IsOrdersCompleted(), false); model.DeleteDrinkFromCurrentOrders(3); Assert.AreEqual(model.IsOrdersCompleted(), true); }
public void DeleteDrinkFromCurrentOrdersTest() { DrinkModel model = new DrinkModel(); for (int i = 0; i < 5; i++) { model.AddDrinkToCurrentOrders(i); } for (int i = 0; i < 6; i++) { model.SetSweetLevel(i, "無糖"); } for (int i = 0; i < 2; i++) { model.DeleteDrinkFromCurrentOrders(i); } Assert.AreEqual(model.IsOrdersCompleted(), false); model.DeleteDrinkFromCurrentOrders(-1); model.DeleteDrinkFromCurrentOrders(10); model.DeleteDrinkFromCurrentOrders(1); model.DeleteDrinkFromCurrentOrders(2); Assert.AreEqual(model.GetOrdersSize(), 2); model.AddDrinkToCurrentOrders(4); Assert.AreEqual(model.IsOrdersCompleted(), false); }
public void GetCurrentOrderDrinkListStringTest() { DrinkModel model = new DrinkModel(); for (int i = 0; i < 5; i++) { model.AddDrinkToCurrentOrders(i); } //for (int i = 0; i < 5; i++) // model.SetSweetLevel(i, "半糖"); for (int i = 0; i < 6; i++) { model.SetTemperature(i, "正常"); } Assert.AreEqual(model.IsOrdersCompleted(), false); List <string> name = new List <string> { "茉莉綠茶", "阿薩姆紅茶", "高山青茶", "鐵觀音", "烏龍青茶" }; List <string> price = new List <string> { "30", "25", "40", "50", "30" }; List <List <string> > list2 = model.GetCurrentOrderDrinkListString(); int j = 0; foreach (List <string> eachItem in list2) { Assert.AreEqual(eachItem[0], name[j]); Assert.AreEqual(eachItem[1], price[j]); j++; } }
public void GetRecordStateTest() { DrinkModel model = new DrinkModel(); for (int i = 0; i < 5; i++) { model.AddDrinkToCurrentOrders(i); } for (int i = 0; i < 6; i++) { model.SetSweetLevel(i, "正常"); } for (int i = 0; i < 7; i++) { model.SetTemperature(i, "少冰"); } Assert.AreEqual(model.IsOrdersCompleted(), true); model.DeleteDrinkFromCurrentOrders(-1); model.DeleteDrinkFromCurrentOrders(10); model.DeleteDrinkFromCurrentOrders(0); model.DeleteDrinkFromCurrentOrders(2); Assert.AreEqual(model.GetOrdersSize(), 3); model.AddDrinkToCurrentOrders(4); model.AddAdditionToCurrentOrders(0, 0); model.AddAdditionToCurrentOrders(0, 0); Assert.AreEqual(model.IsOrdersCompleted(), false); model.DeleteDrinkFromCurrentOrders(3); Assert.AreEqual(model.IsOrdersCompleted(), true); model.AddAdditionToCurrentOrders(0, 0); model.AddAdditionToCurrentOrders(0, 1); List <int> list = model.GetRecordState(0); foreach (int i in list) { Assert.AreEqual(list[i], i); } List <int> list2 = model.GetRecordState(10); Assert.AreEqual(list2.Count, 0); List <int> list3 = model.GetRecordState(-1); Assert.AreEqual(list3.Count, 0); }
public void CheckOutTest() { DrinkModel model = new DrinkModel(); model.CheckOut(); for (int i = 0; i < 5; i++) { model.AddDrinkToCurrentOrders(i); } for (int i = 0; i < 6; i++) { model.SetTemperature(i, "少冰"); } for (int i = 0; i < 6; i++) { model.SetSweetLevel(i, "正常"); } Assert.AreEqual(model.GetOrdersSize(), 5); Assert.AreEqual(model.IsOrdersCompleted(), true); model.CheckOut(); Assert.AreEqual(model.GetOrdersSize(), 0); Assert.AreEqual(model.IsOrdersCompleted(), false); }
public void SetSweetLevelTest() { DrinkModel model = new DrinkModel(); for (int i = 0; i < 5; i++) { model.AddDrinkToCurrentOrders(i); } for (int i = 0; i < 6; i++) { model.SetSweetLevel(i, "半糖"); } Assert.AreEqual(model.GetOrdersSize(), 5); Assert.AreEqual(model.IsOrdersCompleted(), false); }