Пример #1
0
        public void FindAllSwedenFinlandRestaurantsWithCusine_ShouldFindRestaurantsWithLatitudeGraterThan55()
        {
            RestaurantsSearch searchUtility = new RestaurantsSearch();

            //Act
            List<RestaurantBasicData> foundRests = searchUtility.FindAllSwedenFinlandRestaurantsWithCusine();

            //Asset
            Assert.IsNotNull(foundRests);
            Assert.IsFalse(foundRests.Any(r => r.ItemLocation.Latitude <= 55));
            Assert.IsFalse(foundRests.Any(r => r.Cuisine == null));
        }
Пример #2
0
        public void FindAllRestaurantsWithoutCusineAndEmptyMenu_ShouldFindRestaurantsWithEmptyMenyAndWITHOUTCuisine()
        {
            RestaurantsSearch searchUtility = new RestaurantsSearch();

            //Act
            List<RestaurantBasicData> foundRests = searchUtility.FindAllRestaurantsWithoutCusineAndEmptyMenu();

            //Asset
            Assert.IsNotNull(foundRests);
            Assert.IsFalse(foundRests.Any(r => r.Cuisines != null && r.Cuisines.Count > 0));
            Assert.IsFalse(foundRests.Any(r => r.Menu != null && r.Menu.MenuParts != null && r.Menu.MenuParts.Count > 1));
        }
 public List<RestaurantBasicData> GetRestaurants()
 {
     try
     {
         RestaurantsSearch searchUtility = new RestaurantsSearch();
         List<RestaurantBasicData> returnList = searchUtility.FindAllRestaurantsWithoutCusineAndEmptyMenu();
         if (returnList != null && returnList.Count > 0)
         {
             log.InfoFormat("[GetRestaurants] Count of restaurants={0}.", returnList.Count);
             return returnList;
         }
         else
         {
             log.InfoFormat("[GetRestaurants] Restaurants not found.");
             return null;
         }
     }
     catch (Exception e)
     {
         log.InfoFormat("[GetRestaurants] Exception={0}.", e.Message);
         return null;
     }
 }
Пример #4
0
        /// <summary>
        /// Find or fix cuisine and operator for all restaurants from Sweden and Finland
        /// </summary>
        public void SwedenFinlandUpdateCuisines()
        {
            log.InfoFormat("[SwedenFinlandUpdateCuisines].");
            RestaurantsSearch searchUtility = new RestaurantsSearch();
            var allRests = searchUtility.FindAllSwedenFinlandRestaurantsWithCusine();
            ServiceLayerImpl serviceLayer = new ServiceLayerImpl();
            int foundCuisines = 0, notFoundCuisine = 0;
            foreach (var rest in allRests)
            {
                string restName = rest.Name != null ? rest.Name : "";
                string restDescription = rest.Description != null ? rest.Description : "";

                List<CuisineMap> cuisineMaps = cuisineServices.CuisineMapSearch(rest, "Finland");
                if (cuisineMaps != null && cuisineMaps.Count > 0)
                {
                    string cuisinesList = rest.Cuisines != null ? String.Join(", ", rest.Cuisines.ToArray()) : "Empty";
                    log.InfoFormat("[SwedenFinlandUpdateCuisines] Cuisine found. Cuisines list={0}, Cuisine.Count={1}, Restaurant.Name={2}, Restaurant.Description={3}.", cuisinesList, cuisineMaps.Count, restName, restDescription);
                    serviceLayer.UpdateRestaurant(rest);
                    foundCuisines++;
                }
                else 
                {
                    log.InfoFormat("[SwedenFinlandUpdateCuisines] Cuisine not found. Restaurant.Name={0}, Restaurant.Id={1}, Restaurant.Description={2}.", restName, rest.Id.ToString(), restDescription);
                    notFoundCuisine++;
                }
            }
            log.InfoFormat("[SwedenFinlandUpdateCuisines] foundCuisines={0}, notFoundCuisine={1}, allRests={2}.", foundCuisines, notFoundCuisine, allRests.Count);
        }
Пример #5
0
 public void UpdateDefaultMenusToFinlandSwedenRestaurants()
 {
     log.InfoFormat("[UpdateDefaultMenusToFinlandSwedenRestaurants].");
     RestaurantsSearch searchUtility = new RestaurantsSearch();
     //var restList = searchUtility.FindAllSwedenFinlandRestaurantsWithCusine();
     var restList = searchUtility.FindAllSwedenFinlandRestaurants();
     AddDefaultsMenusToSwedenFinlandRests(restList);
     //AddDefaultsMenus(restList);
 }