Example #1
0
        public void Test_GetRestaurants_RetrievesAllRestaurantsWithCuisine()
        {
            Cuisine testCuisine = new Cuisine("Chinese Food");

            testCuisine.Save();

            Restaurant firstRestaurant = new Restaurant("PF Changs", "A chinese food chain.", testCuisine.GetId());

            firstRestaurant.Save();
            Restaurant secondRestaurant = new Restaurant("Panda Express", "Chinese fast-food.", testCuisine.GetId());

            secondRestaurant.Save();

            List <Restaurant> testRestaurantList = new List <Restaurant> {
                firstRestaurant, secondRestaurant
            };
            List <Restaurant> resultRestaurantList = testCuisine.GetRestaurants();

            Assert.Equal(testRestaurantList, resultRestaurantList);
        }
Example #2
0
        public void Test_GetRestaurants_ReturnsAllRestaurantsWithinCategory()
        {
            Cuisine cuisine1 = new Cuisine("Japanese");
            Cuisine cuisine2 = new Cuisine("Italian");

            cuisine1.Save();
            cuisine2.Save();

            Restaurant restaurant1 = new Restaurant("Tako", "Not a place to get tacos.", "$", cuisine1.GetId());
            Restaurant restaurant2 = new Restaurant("Mario\'s", "Fresh pasta, fresher sauce.", "$$", cuisine2.GetId());
            Restaurant restaurant3 = new Restaurant("Peperoncini", "Focused on the flavor of tasty peperoncini.", "$", cuisine2.GetId());

            restaurant1.Save();
            restaurant2.Save();
            restaurant3.Save();

            List <Restaurant> expectedRestaurants = new List <Restaurant> {
                restaurant2, restaurant3
            };
            List <Restaurant> results = cuisine2.GetRestaurants();

            Assert.Equal(expectedRestaurants, results);
        }