UpdateDishesLocation() public méthode

public UpdateDishesLocation ( ) : void
Résultat void
        public void AddDefaultMenuToRestaurant(RestaurantBasicData rest) 
        {
            try
            {
                if (rest != null)
                {
                    string cuisinesList = rest.Cuisines != null ? String.Join(", ", rest.Cuisines.ToArray()) : "Empty";
                    var TempMenus = GetDefaultMenusList(rest);
                    if (TempMenus != null && TempMenus.Count > 0)
                    {
                        ServiceLayerImpl serviceLayer = new ServiceLayerImpl();
                        rest.Menu = CombineMenus(TempMenus);
                        log.InfoFormat("[AddDefaultMenuToRestaurant] Found default Menu for rest.Name={0}, rest.Id={1}, Cuisines List={2}.", rest.Name, rest.Id.ToString(), cuisinesList);
                        rest.UpdateDishesLocation();
                        serviceLayer.UpdateRestaurant(rest);
                    }
                    else 
                    {
                        log.InfoFormat("[AddDefaultMenuToRestaurant] Not found default Menu for rest.Name={0}, rest.Id={1}, Cuisines List={2}.", rest.Name, rest.Id.ToString(), cuisinesList);
                    }

                }
                else 
                {
                    log.WarnFormat("[AddDefaultMenuToRestaurant] input restayrant is null.");
                }
            }
            catch (Exception e) 
            {
                log.ErrorFormat("[AddDefaultMenuToRest] Exception={0}.", e.Message);
            }
        }
        public void TestUpdateDishesLocation_shouldChangeLocationOfAllDishesToRestaurantLocation()
        {
            RestaurantBasicData restaurant = new RestaurantBasicData()
            {
                //arrange
                Id = ObjectId.Parse("50ae8b2a3720e80d085376db"),
                ItemLocation = new Location() { Latitude = 32.279296, Longitude = 34.860367 },
                Menu = new Menu()
            };

            Dish dish1 = new Dish()
            {
                Id = 1,
                Description = "סלט ירקות עם חתיכות חזה עוף",
                DishState = DishStateEnum.Active,
                Name = "סלט קיסר",
                NutritionFacts = new NutritionFacts(),
                ItemLocation = new Location() { Latitude = 30, Longitude = 27 },
                ImageUrl = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRqKcIkvCQDkCNQkXq0TWtiqRSF5ryYK7NYB79ZBVebpjKBVPcA",
                IsItPublic = true,
                MappedState = new SuspiciousState() { Index = 7.77 },
                RecipeId = 10,
                State = new SuspiciousState() { Index = 7.77 },
                OverrideIngredients = new List<Ingredient>()
            };
            Dish dish2 = new Dish()
            {
                Id = 3,
                Description = "שניצל מוגש עם צ'יפס",
                DishState = DishStateEnum.Active,
                Name = "שניצל",
                NutritionFacts = new NutritionFacts(),
                ItemLocation = new Location() { Latitude = 31, Longitude = 29 },
                ImageUrl = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQX5WBzP336hF8Q0FQpk5TdX8m7GI7ymVqJMtyrzSA3afEkqfU8CA",
                IsItPublic = true,
                MappedState = new SuspiciousState() { Index = 8.88 },
                RecipeId = 28,
                State = new SuspiciousState() { Index = 8.88 },
                OverrideIngredients = new List<Ingredient>()
            };
            Dish dish3 = new Dish()
            {
                Id = 15,
                Description = "המבורגר 220גר עם צ'יפס בצד",
                DishState = DishStateEnum.Active,
                Name = "המבורגר",
                NutritionFacts = new NutritionFacts(),
                ItemLocation = new Location() { Latitude = 32, Longitude = 30 },
                ImageUrl = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTmEsDLKjW9dj_Vl8SMdESJkTBGncjY5QDt0sqK77txEUwSi2RzUA",
                IsItPublic = true,
                MappedState = new SuspiciousState() { Index = 50 },
                RecipeId = 169,
                State = new SuspiciousState() { Index = 50 },
                OverrideIngredients = new List<Ingredient>()
            };
                        Dish dish4 = new Dish()
            {
                Id = 4,
                Description = "חזה עך עם תוספת",
                DishState = DishStateEnum.Active,
                Name = "חזה עוף",
                NutritionFacts = new NutritionFacts(),
                ItemLocation = new Location() { Latitude = 32.89654, Longitude = 31.321 },
                IsItPublic = true,
                MappedState = new SuspiciousState() { Index = 45.5 },
                RecipeId = 169,
                State = new SuspiciousState() { Index = 45.5 },
                OverrideIngredients = new List<Ingredient>()
            };
            MenuPart menuPart1 = new MenuPart(){Name = "עיקריות"};
            menuPart1.Dishes.Add(dish1);
            menuPart1.Dishes.Add(dish2);
            menuPart1.Dishes.Add(dish3);
            MenuPart menuPart2 = new MenuPart(){Name = "מנה ראשונה"};
            menuPart2.Dishes.Add(dish1);
            menuPart2.Dishes.Add(dish2);
            menuPart2.Dishes.Add(dish3);
            restaurant.Menu.MenuParts.Add(menuPart1);
            restaurant.Menu.MenuParts.Add(menuPart2);

            //act

            restaurant.UpdateDishesLocation();

            //assert

            int dishCount = 0;
            foreach (var part in restaurant.Menu.MenuParts)
            {
                foreach (var dish in part.Dishes)
                {
                    dishCount++;
                    Assert.AreEqual(restaurant.ItemLocation, dish.ItemLocation);
                }
            }
            //Chech if all dishes saved
            Assert.AreEqual(dishCount, 6);
        }