public void Test_Find_FindsCuisinesInDatabase()
        {
            Cuisines testCuisines = new Cuisines("Egyptian");

            testCuisines.Save();

            Cuisines foundCuisines = Cuisines.Find(testCuisines.GetId());

            Assert.Equal(testCuisines, foundCuisines);
        }
        public void Test_Update_UpdatesCuisinesInDatabase()
        {
            string   name         = "American";
            Cuisines testCuisines = new Cuisines(name);

            testCuisines.Save();
            string newCuisines = "Chinese";

            testCuisines.Update(newCuisines);
            string result = testCuisines.GetName();

            Assert.Equal(newCuisines, result);
        }
        public void Test_Save_SavesCuisineToDatabase()
        {
            Cuisines testCuisines = new Cuisines("Equidorian");

            testCuisines.Save();

            List <Cuisines> result   = Cuisines.GetAll();
            List <Cuisines> testList = new List <Cuisines> {
                testCuisines
            };

            Assert.Equal(testList, result);
        }
Пример #4
0
 public override bool Equals(System.Object otherCuisines)
 {
     if (!(otherCuisines is Cuisines))
     {
         return(false);
     }
     else
     {
         Cuisines newCuisines  = (Cuisines)otherCuisines;
         bool     idEquality   = this.GetId() == newCuisines.GetId();
         bool     nameEquality = this.GetName() == newCuisines.GetName();
         return(idEquality && nameEquality);
     }
 }
        public void Test_GetCuisines_RetrieveAllRestaurantsWithCuisines()
        {
            Cuisines testCuisines = new Cuisines("Indian");

            testCuisines.Save();

            Restaurants firstRestaurant = new Restaurants("TajMaHal", "2nd and Madison", new DateTime(2016, 2, 14), "blue", testCuisines.GetId());

            firstRestaurant.Save();
            Restaurants secondRestaurant = new Restaurants("TajMaBal", "3rd and Madison", new DateTime(2014, 8, 8), "red", testCuisines.GetId());

            secondRestaurant.Save();

            List <Restaurants> testRestaurantsList = new List <Restaurants> {
                firstRestaurant, secondRestaurant
            };
            List <Restaurants> resultRestaurantsList = testCuisines.GetRestaurants();

            Assert.Equal(testRestaurantsList, resultRestaurantsList);
        }
        public void Test_CuisinesEmptyAtFirst()
        {
            int result = Cuisines.GetAll().Count;

            Assert.Equal(0, result);
        }
 public void Dispose()
 {
     Restaurants.DeleteAll();
     Cuisines.DeleteAll();
 }