ToDishModel() public method

public ToDishModel ( Dish dishData, string restId, int MenuPId, string lang = DefaultLang, RestaurantModel restaurantModel = null ) : DishModel
dishData Spontaneous.DataModel.Dish
restId string
MenuPId int
lang string
restaurantModel Spontaneous.WebApp.Models.RestaurantModel
return Spontaneous.WebApp.Models.DishModel
Exemplo n.º 1
0
        public void ToBaseLineViewModelTest_IfBaseLineSuspiciousStateMustBeZero()
        {
            Dish dish1 = new Dish()
            {
                Name = "dish1",
                Description = "description1",
                NutritionFacts = new NutritionFacts() { TotalCarbohydrate = 2 }
            };

            ToViewModelConverter converter = new ToBaseLineViewModel();

            DishModel dishModel1 = converter.ToDishModel(dish1, "111111");

            Assert.IsTrue(dishModel1.State.Index == 0);
        }
Exemplo n.º 2
0
        public void ToBaseLineViewModelTest_IfBaseLineIsNullShouldReturnRegularCarbohydrateLevel()
        {
            Dish dish1 = new Dish()
            {
                Name = "dish1",
                Description = "description1",
                NutritionFacts = new NutritionFacts() { TotalCarbohydrate = 2 }
            };

            ToViewModelConverter converter = new ToBaseLineViewModel();

            DishModel dishModel1 = converter.ToDishModel(dish1, "111111");

            Assert.IsTrue(dishModel1.NutritionFacts.TotalCarbohydrate == 2);
        }
Exemplo n.º 3
0
        public void ToBaseLineViewModelTest_ShouldConverWithMenuPartIdParameter()
        {
            Dish dish1 = new Dish()
            {
                Name = "dish1",
                Description = "description1",
                NutritionFacts = new NutritionFacts() { TotalCarbohydrate = 2 },
                BaseLineNutritionFacts = new NutritionFacts() { TotalCarbohydrate = 1 }
            };

            ToViewModelConverter converter = new ToBaseLineViewModel();

            DishModel dishModel1 = converter.ToDishModel(dish1, "111111", 3);

            Assert.IsTrue(dishModel1.MenuPartId == 3);
        }
Exemplo n.º 4
0
        public void ToBaseLineViewModelTest_ShouldConverToViewModelWithBaseLineCarbohydrateLevel()
        {
            Dish dish1 = new Dish()
            {
                Name = "dish1",
                Description = "description1",
                NutritionFacts = new NutritionFacts() { TotalCarbohydrate = 2 },
                BaseLineNutritionFacts = new NutritionFacts() { TotalCarbohydrate = 1 }
            };

            ToViewModelConverter converter = new ToBaseLineViewModel();

            DishModel dishModel1 = converter.ToDishModel(dish1, "111111");

            Assert.IsTrue(dishModel1.NutritionFacts.TotalCarbohydrate == 1);
        }