CreaeteFromMealAndUserData() public méthode

public CreaeteFromMealAndUserData ( Meal userMeal, string userName, SpontaneousUserModel userData ) : UserMealProfile
userMeal Spontaneous.DataModel.Meal
userName string
userData Spontaneous.DataModel.SpontaneousUserModel
Résultat Spontaneous.DataModel.UserMealProfile
        public void CreaeteFromMealAndUserDataTest_ShouldCreateUserMealProfileObjectWithAllRelevantDataOfInputParameters()
        {
            Meal userMeal = new Meal()
            {
                Id = Guid.NewGuid(),
                PreMealSugarLevel = 290,
                PostMealSugarLevel = 170
            };
            string userName = "******";
            UserBaseInsulinCalcProfile insulineProfile = new RapidInsulinProfile()
            {
                UnitReductionValue = 40,
                InsulinCarbohydrateRatio = 12.5,
                MaxSugarRange = 150
            };
            SpontaneousUserModel userData = new SpontaneousUserModel()
            {
                BaseInsulinCalcProfile = insulineProfile,
            };

            //act
            UserMealProfileFactory mealFactory = new UserMealProfileFactory();
            UserMealProfile mealProfile = mealFactory.CreaeteFromMealAndUserData(userMeal, userName, userData);

            //assert
            Assert.IsNotNull(mealProfile);
            Assert.AreEqual(mealProfile.MealId, userMeal.Id);
            Assert.AreEqual(mealProfile.UserName, userName);
            Assert.AreEqual(mealProfile.UserInsulinProfile, insulineProfile);
        }
        public void CreaeteFromMealAndUserDataTest_ShouldCreateUserMealProfileObjectWithCorrectCalculatedCarbsDeviation_and_MealCarbsAmount_Properies()
        {
            Meal userMeal = new Meal()
            {
                Id = Guid.NewGuid(),
                PreMealSugarLevel = 290,
                PostMealSugarLevel = 170,
                CarbAmount = 85
            };
            string userName = "******";
            UserBaseInsulinCalcProfile insulineProfile = new RapidInsulinProfile()
            {
                UnitReductionValue = 40,
                InsulinCarbohydrateRatio = 12.5,
                MaxSugarRange = 150
            };
            SpontaneousUserModel userData = new SpontaneousUserModel()
            {
                BaseInsulinCalcProfile = insulineProfile,
            };

            //act
            UserMealProfileFactory mealFactory = new UserMealProfileFactory();
            UserMealProfile mealProfile = mealFactory.CreaeteFromMealAndUserData(userMeal, userName, userData);

            AlgorithmCalculations.AlgorithmResult algResult = AlgorithmCalculations.CalcMealCarbsDeviation(userMeal, mealProfile.UserInsulinProfile);

            //assert
            Assert.IsNotNull(mealProfile);
            Assert.AreEqual(mealProfile.CalculatedCarbsDeviation, algResult.Result);
            Assert.AreEqual(mealProfile.MealCarbsAmount, mealProfile.ExpectedCarbsAmount + algResult.Result);
        }
        public void CreaeteFromMealAndUserDataTest_ShouldReturnNullIfOneOfInputParametersIsNullOrEmpty()
        {
            Meal userMeal = new Meal()
            {
                Id = Guid.NewGuid(),
                PreMealSugarLevel = 290,
                PostMealSugarLevel = 170
            };
            string userName = "******";
            UserBaseInsulinCalcProfile insulineProfile = new RapidInsulinProfile()
            {
                UnitReductionValue = 40,
                InsulinCarbohydrateRatio = 12.5,
                MaxSugarRange = 150
            };
            SpontaneousUserModel userData = new SpontaneousUserModel()
            {
                BaseInsulinCalcProfile = insulineProfile,
            };

            //act
            UserMealProfileFactory mealFactory = new UserMealProfileFactory();
            UserMealProfile mealProfile1 = mealFactory.CreaeteFromMealAndUserData(null, userName, userData);
            UserMealProfile mealProfile2 = mealFactory.CreaeteFromMealAndUserData(userMeal, null, userData);
            UserMealProfile mealProfile3 = mealFactory.CreaeteFromMealAndUserData(userMeal, userName, null);

            //assert
            Assert.IsNull(mealProfile1);
            Assert.IsNull(mealProfile2);
            Assert.IsNull(mealProfile3);
        }