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 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 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); }