Beispiel #1
0
        public void ClearAll_DeleteAllCusines_Int()
        {
            Cuisine newFood = new Cuisine("Mexican");

            newFood.Create();
            Restaurant newRestaurant1 = new Restaurant("1", newFood.Id);

            newRestaurant1.Create();
            Restaurant newRestaurant2 = new Restaurant("2", newFood.Id);

            newRestaurant2.Create();
            Restaurant newRestaurant3 = new Restaurant("3", newFood.Id);

            newRestaurant3.Create();
            Restaurant newRestaurant4 = new Restaurant("4", newFood.Id);

            newRestaurant4.Create();
            Restaurant.ClearAll();
            Restaurant newfood5 = new Restaurant("5", newFood.Id);

            newfood5.Create();
            int result = Restaurant.GetAll().Count;

            Assert.AreEqual(result, 1);
        }
Beispiel #2
0
        public void Create_CuisineAddedCorrectly_True()
        {
            Cuisine newfood = new Cuisine("Mexican");

            newfood.Create();

            Cuisine test = Cuisine.GetAll() [0];

            Assert.AreEqual(newfood.FoodType, test.FoodType);
        }
Beispiel #3
0
        public void Create_CuisineAddedCorrectly_True()
        {
            Cuisine newfood = new Cuisine("Mexican");

            newfood.Create();
            Restaurant newRest = new Restaurant("Happies", newfood.Id);

            newRest.Create();

            Assert.AreEqual("Happies", newRest.Name);
        }
Beispiel #4
0
        public void Update_ChangeCuisineNameCorrectly_True()
        {
            Cuisine newFood = new Cuisine("Mexican");

            newFood.Create();
            Console.WriteLine(newFood.Id);
            newFood.Update("Fake Mexican");

            Cuisine result = Cuisine.GetAll()[0];

            Assert.AreEqual("Fake Mexican", newFood.FoodType);
        }
Beispiel #5
0
        public void Update_ChangeCuisineNameCorrectly_True()
        {
            Cuisine newCuisine = new Cuisine("Italian");

            newCuisine.Create();
            Restaurant newRestaurant = new Restaurant("Yumm!", newCuisine.Id);

            newRestaurant.Create();

            newRestaurant.Update("Gross!");

            Assert.AreEqual("Gross!", newRestaurant.Name);
        }
        public ActionResult Create()
        {
            List <Cuisine> cuisineList = Cuisine.GetAll();

            int flag = 0;

            foreach (Cuisine cuisine in cuisineList)
            {
                if (cuisine.FoodType == Request.Form["newCuisine"])
                {
                    flag++;
                }
            }
            if (flag == 0)
            {
                Cuisine newCuisine = new Cuisine(Request.Form["newCuisine"]);
                newCuisine.Create();
            }
            return(RedirectToAction("Index", "Restaurants"));
        }
Beispiel #7
0
        public void ClearAll_DeleteAllCusines_Int()
        {
            Cuisine newfood1 = new Cuisine("Mexican");

            newfood1.Create();
            Cuisine newfood2 = new Cuisine("American");

            newfood2.Create();
            Cuisine newfood3 = new Cuisine("Italian");

            newfood3.Create();
            Cuisine newfood4 = new Cuisine("Chinese");

            newfood4.Create();
            Cuisine.ClearAll();
            Cuisine newfood5 = new Cuisine("Vietnamese");

            newfood5.Create();
            int result = Cuisine.GetAll().Count;

            Assert.AreEqual(result, 1);
        }