コード例 #1
0
        public void GetTotalPriceTest()
        {
            CustomerFormPresentationModel model = new CustomerFormPresentationModel(new Model());

            model.AddMeal(model.FindMealByName("薯條(小包)"));
            model.AddMeal(model.FindMealByName("薯條(中包)"));
            model.AddToDisplayMealList();
            Assert.AreEqual(model.GetTotalPrice(), 74);
        }
コード例 #2
0
        public void AddMealTest()
        {
            CustomerFormPresentationModel model = new CustomerFormPresentationModel(new Model());

            model.AddMeal(model.FindMealByName("薯條(小包)"));
            model.AddMeal(model.FindMealByName("薯條(中包)"));
            Assert.AreEqual(model.GetMealList()[0].Name, "薯條(小包)");
            Assert.AreEqual(model.GetMealList()[1].Name, "薯條(中包)");
        }
コード例 #3
0
        public void ClearMealListTest()
        {
            CustomerFormPresentationModel model = new CustomerFormPresentationModel(new Model());

            model.AddMeal(model.FindMealByName("薯條(小包)"));
            model.AddMeal(model.FindMealByName("薯條(中包)"));
            Assert.AreEqual(model.GetMealList().Count, 2);
            model.ClearMealList();
            Assert.AreEqual(model.GetMealList().Count, 0);
        }
コード例 #4
0
        public void DeleteFromDisplayMealListTest()
        {
            CustomerFormPresentationModel model = new CustomerFormPresentationModel(new Model());

            model.AddMeal(model.FindMealByName("薯條(小包)"));
            model.AddMeal(model.FindMealByName("薯條(中包)"));
            model.AddToDisplayMealList();
            Assert.AreEqual(model.GetDisplayMealList().Count, 2);
            model.DeleteFromDisplayMealList("薯條(小包)");
            Assert.AreEqual(model.GetDisplayMealList().Count, 1);
            model.DeleteFromDisplayMealList("薯條(中包)");
            Assert.AreEqual(model.GetDisplayMealList().Count, 0);
        }
コード例 #5
0
        public void IsAddButtonEnableTest()
        {
            CustomerFormPresentationModel model = new CustomerFormPresentationModel(new Model());

            Assert.IsFalse(model.IsAddButtonEnable());
            model.AddMeal(model.FindMealByName("大麥克"));
            Assert.IsTrue(model.IsAddButtonEnable());
        }
コード例 #6
0
        public void GetMealButtonCategoryIndexTest()
        {
            CustomerFormPresentationModel model = new CustomerFormPresentationModel(new Model());

            Assert.AreEqual(model.GetMealButtonCategoryIndex(model.FindMealByName("大麥克")), 0);
        }
コード例 #7
0
        public void FindMealByNameTest()
        {
            CustomerFormPresentationModel model = new CustomerFormPresentationModel(new Model());

            Assert.AreEqual("大麥克", model.FindMealByName("大麥克").Name);
        }