Inheritance: ToViewModelConverter
Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
        }