예제 #1
0
        public void DeleteListTest()
        {
            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 < 6; i++)
            {
                model.SetTemperature(i, "少冰");
            }
            List <string> name = new List <string> {
                "珍珠", "椰果", "仙草", "布丁"
            };
            List <string> price = new List <string> {
                "5", "5", "10", "10"
            };
            List <List <string> > list2 = model.GetAdditionMenuString();
            int j = 0;

            foreach (List <string> eachItem in list2)
            {
                Assert.AreEqual(eachItem[0], name[j]);
                Assert.AreEqual(eachItem[1], price[j]);
                j++;
            }
            model.DeleteList(-1, false);
            model.DeleteList(10, false);
            model.DeleteList(0, false);
            List <List <string> > list3 = model.GetAdditionMenuString();
            int k = 1;

            foreach (List <string> eachItem in list3)
            {
                Assert.AreEqual(eachItem[0], name[k]);
                Assert.AreEqual(eachItem[1], price[k]);
                k++;
            }
            List <string> drinkMame = new List <string> {
                "茉莉綠茶", "阿薩姆紅茶", "高山青茶", "鐵觀音", "烏龍青茶"
            };
            List <string> drinkPrice = new List <string> {
                "30", "25", "40", "50", "30"
            };
            List <List <string> > list4 = model.GetAdditionMenuString();

            model.DeleteList(-1, true);
            model.DeleteList(10, true);
            model.DeleteList(0, true);
            int y = 1;

            foreach (List <string> eachItem in list4)
            {
                Assert.AreEqual(eachItem[0], name[y]);
                Assert.AreEqual(eachItem[1], price[y]);
                y++;
            }
            model.DeleteList(10, true);
            model.DeleteList(10, false);
        }