public void GetDishModelTest_ShouldReturnRestaurantModelWithDishModelBackOfficeIfCalledWithRestaurantModelBackOfficeParameter()
        {
            Dish dish1 = new Dish()
            {
                Name = "TempDish1",
                Description = "description",
                Id = 1,
                NutritionFacts = new NutritionFacts(),
                BaseLineNutritionFacts = new NutritionFacts()
            };
            Dish dish2 = new Dish()
            {
                Name = "TempDish2",
                Description = "description",
                Id = 2,
                NutritionFacts = new NutritionFacts(),
                BaseLineNutritionFacts = new NutritionFacts()
            };
            Dish dish3 = new Dish()
            {
                Name = "TempDish3",
                Description = "description",
                Id = 3,
                NutritionFacts = new NutritionFacts(),
                BaseLineNutritionFacts = new NutritionFacts()
            };
            Dish dish4 = new Dish()
            {
                Name = "TempDish4",
                Description = "description",
                Id = 4,
                NutritionFacts = new NutritionFacts(),
                BaseLineNutritionFacts = new NutritionFacts()
            };

            var dishList1 = new List<Dish>();
            dishList1.Add(dish1);
            dishList1.Add(dish2);
            var dishList2 = new List<Dish>();
            dishList2.Add(dish3);
            dishList2.Add(dish4);

            MenuPart menuPart1 = new MenuPart()
            {
                Name = "TestMenuPart",
                Id = 1,
                OrderBy = 1,
                Dishes = dishList1
            };
            MenuPart menuPart2 = new MenuPart()
            {
                Name = "TestMenuPart",
                Id = 2,
                OrderBy = 2,
                Dishes = dishList1
            };
            List<MenuPart> menuPartsList = new List<MenuPart>();
            menuPartsList.Add(menuPart1);
            menuPartsList.Add(menuPart2);
            Menu menu = new Menu();
            menu.MenuParts.Add(menuPart1);
            menu.MenuParts.Add(menuPart2);
            RestaurantBasicData restBasic = new RestaurantBasicData()
            {
                Name = "TestRest",
                Id = new ObjectId(),
                Menu = menu
            };

            RestaurantModelBackOffice restBO = new RestaurantModelBackOffice();
            var restModel = restBasic.ToRestaurantModel(true, "he", restBO);
            foreach (var menuPart in restModel.Menu.MenuParts)
            {
                foreach (DishModel dishModel in menuPart.Dishes)
                {
                    Assert.IsTrue(dishModel.GetType() == typeof(DishModelBackOffice));
                }
            }
        }
        public void ToRestaurantModel_ShouldConvertMenuToMenuModel_AllDishesAndMenusNamesToSpecificLanguage()
        {
            //arrange
            RestaurantBasicData rest = new RestaurantBasicData()
            {
                Name = "מסעדה",
                Description = "מסעדת נסיון",
                LocalizedName = new Localized("he", "מסעדה"),
                LocalizedDescription = new Localized("he", "מסעדת נסיון")
            };
            rest.LocalizedName.AddDescription("en-US", "restaurant");
            rest.LocalizedDescription.AddDescription("en-US", "test restaurant");

            Dish dish1 = new Dish()
            {
                Id = 111,
                Name = "אורז לבן",
                Description = "אורז לבן מבושל",
                LocalizedName = new Localized("he", "אורז לבן"),
                LocalizedDescription = new Localized("he", "אורז לבן מבושל"),
                DefaultWeight = new WeightType()
                {
                    Desc = "100 גרם",
                    LocalizedDescription = new Localized("he", "100 גרם")
                }
            };
            dish1.LocalizedName.AddDescription("en-US", "white rice");
            dish1.LocalizedDescription.AddDescription("en-US", "cooked white rice");
            dish1.DefaultWeight.LocalizedDescription.AddDescription("en-US", "100 gramm");

            Dish dish2 = new Dish()
            {
                Id = 222,
                Name = "תפוח אדמה",
                Description = "תפוח אדמה אפוי",
                LocalizedName = new Localized("he", "תפוח אדמה"),
                LocalizedDescription = new Localized("he", "תפוח אדמה אפוי"),
                DefaultWeight = new WeightType()
                {
                    Desc = "100 גרם",
                    LocalizedDescription = new Localized("he", "200 גרם")
                }
            };
            dish2.LocalizedName.AddDescription("en-US", "Potato");
            dish2.LocalizedDescription.AddDescription("en-US", "Baked Potato");
            dish2.DefaultWeight.LocalizedDescription.AddDescription("en-US", "200 gramm");

            Menu menu = new Menu()
            {
                Id = 1,
                MenuParts = new List<MenuPart>()
            };
            MenuPart menuPart = new MenuPart(){
                Id = 1,
                Name = "תוספות",
                LocalizedName = new Localized("he", "תוספות"),
                Dishes = new List<Dish>()
            };
            menuPart.LocalizedName.AddDescription("en-US", "garnish");
            menuPart.Dishes.Add(dish1);
            menuPart.Dishes.Add(dish2);
            menu.MenuParts.Add(menuPart);

            rest.Menu = menu;

            //act
            RestaurantModel restModelDefault = rest.ToRestaurantModel();
            RestaurantModel restModelHe = rest.ToRestaurantModel(true, "he");
            RestaurantModel restModelEn = rest.ToRestaurantModel(true, "en-US");
            RestaurantModel restModelUknown = rest.ToRestaurantModel(true, "123");

            //Assert
            Assert.AreEqual(restModelDefault.Language, "he");
            Assert.AreEqual(restModelDefault.Name, "מסעדה");
            Assert.AreEqual(restModelDefault.Description, "מסעדת נסיון");
            Assert.AreEqual(restModelHe.Language, "he");
            Assert.AreEqual(restModelHe.Name, "מסעדה");
            Assert.AreEqual(restModelHe.Description, "מסעדת נסיון");
            Assert.AreEqual(restModelEn.Language, "en-US");
            Assert.AreEqual(restModelEn.Name, "restaurant");
            Assert.AreEqual(restModelEn.Description, "test restaurant");
            Assert.AreEqual(restModelUknown.Language, "123");
            Assert.AreEqual(restModelUknown.Name, "מסעדה");
            Assert.AreEqual(restModelUknown.Description, "מסעדת נסיון");

            Assert.AreEqual(restModelDefault.Menu.MenuParts[0].Language, "he");
            Assert.AreEqual(restModelDefault.Menu.MenuParts[0].Name, "תוספות");
            Assert.AreEqual(restModelEn.Menu.MenuParts[0].Language, "en-US");
            Assert.AreEqual(restModelEn.Menu.MenuParts[0].Name, "garnish");
            Assert.AreEqual(restModelHe.Menu.MenuParts[0].Language, "he");
            Assert.AreEqual(restModelHe.Menu.MenuParts[0].Name, "תוספות");

            Assert.AreEqual(restModelDefault.Menu.MenuParts[0].Dishes[0].Name, "אורז לבן");
            Assert.AreEqual(restModelDefault.Menu.MenuParts[0].Dishes[0].DefaultWeight.Desc, "100 גרם");
            Assert.AreEqual(restModelDefault.Menu.MenuParts[0].Dishes[1].Name, "תפוח אדמה");
            Assert.AreEqual(restModelDefault.Menu.MenuParts[0].Dishes[1].DefaultWeight.Desc, "200 גרם");

            Assert.AreEqual(restModelHe.Menu.MenuParts[0].Dishes[0].Name, "אורז לבן");
            Assert.AreEqual(restModelHe.Menu.MenuParts[0].Dishes[0].DefaultWeight.Desc, "100 גרם");
            Assert.AreEqual(restModelHe.Menu.MenuParts[0].Dishes[1].Name, "תפוח אדמה");
            Assert.AreEqual(restModelHe.Menu.MenuParts[0].Dishes[1].DefaultWeight.Desc, "200 גרם");

            Assert.AreEqual(restModelEn.Menu.MenuParts[0].Dishes[0].Name, "white rice");
            Assert.AreEqual(restModelEn.Menu.MenuParts[0].Dishes[0].DefaultWeight.Desc, "100 gramm");
            Assert.AreEqual(restModelEn.Menu.MenuParts[0].Dishes[1].Name, "Potato");
            Assert.AreEqual(restModelEn.Menu.MenuParts[0].Dishes[1].DefaultWeight.Desc, "200 gramm");
        }