public FindAllSwedenFinlandRestaurantsWithCusine ( ) : List |
||
Résultat | List |
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)); }
/// <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); }