public Engine( IProductFactory productFactory, IActivityFactory activityFactory, IGoalFactory goalFactory, IDailyNutriCalc dailyNutriCalc, IRestingEnergyCalculator restingEnergyCalculator, IJsonSerializer jsonSerializer, IDataRepository dataRepository, ISuggestedDailyNutrientsIntakeCalc suggestedDailyNutrientsIntakeCalc) { Guard.WhenArgument(productFactory, "Product factory can not be null").IsNull().Throw(); Guard.WhenArgument(activityFactory, "Activity factory can not be null").IsNull().Throw(); Guard.WhenArgument(goalFactory, "Goal factory can not be null").IsNull().Throw(); Guard.WhenArgument(dailyNutriCalc, "DailyNutriCalc can not be null").IsNull().Throw(); Guard.WhenArgument(restingEnergyCalculator, "RestingEnergyCalculator can not be null").IsNull().Throw(); this.productFactory = productFactory; this.activityFactory = activityFactory; this.goalFactory = goalFactory; this.dailyNutriCalc = dailyNutriCalc; this.restingEnergyCalculator = restingEnergyCalculator; this.jsonSerializer = jsonSerializer; this.dataRepository = dataRepository; this.suggestedDailyNutrientsIntakeCalc = suggestedDailyNutrientsIntakeCalc; // JSON deserialization for current date. LoadProgress(); }
public double CalculateSuggestedDailyCarbsIntake(IGoal currentGoal, IRestingEnergyCalculator restingEnergyCalculator) { double suggestCarbsIntake = 0; switch (currentGoal.GoalType) { case GoalType.loseweight: suggestCarbsIntake = 0.25 * CalculateSuggestedDailyCalorieIntake(currentGoal, restingEnergyCalculator) / 4; break; case GoalType.maintainweight: suggestCarbsIntake = 0.4 * CalculateSuggestedDailyCalorieIntake(currentGoal, restingEnergyCalculator) / 4; break; case GoalType.gainweight: suggestCarbsIntake = 0.5 * CalculateSuggestedDailyCalorieIntake(currentGoal, restingEnergyCalculator) / 4; break; } return(suggestCarbsIntake); }
public double CalculateSuggestedDailyFatIntake(IGoal currentGoal, IRestingEnergyCalculator restingEnergyCalculator) { double suggestFatIntake = 0; switch (currentGoal.GoalType) { case GoalType.loseweight: suggestFatIntake = (int)(0.35 * CalculateSuggestedDailyCalorieIntake(currentGoal, restingEnergyCalculator) / 9); break; case GoalType.maintainweight: suggestFatIntake = (int)(0.3 * CalculateSuggestedDailyCalorieIntake(currentGoal, restingEnergyCalculator) / 9); break; case GoalType.gainweight: suggestFatIntake = (int)(0.2 * CalculateSuggestedDailyCalorieIntake(currentGoal, restingEnergyCalculator) / 9); break; } return(suggestFatIntake); }
internal EngineBuilder() { this.productFactory = new Mock <IProductFactory>().Object; this.activityFactory = new Mock <IActivityFactory>().Object; this.goalFactory = new Mock <IGoalFactory>().Object; this.dailyNutriCalc = new Mock <IDailyNutriCalc>().Object; this.restingEnergyCalculator = new Mock <IRestingEnergyCalculator>().Object; this.jsonSerializer = new Mock <IJsonSerializer>().Object; this.dataRepository = new Mock <IDataRepository>().Object; this.suggestedDailyNutrientsIntakeCalc = new Mock <ISuggestedDailyNutrientsIntakeCalc>().Object; }
public double CalculateSuggestedDailyCalorieIntake(IGoal goal, IRestingEnergyCalculator restingEnergyCalculator) { var RestingEnergy = restingEnergyCalculator.CalculateRestingEnergy(goal); switch (goal.ActivityLevel) { case ActivityLevel.light: this.DailyCalorieIntake = RestingEnergy * 1.375; break; case ActivityLevel.moderate: this.DailyCalorieIntake = RestingEnergy * 1.55; break; case ActivityLevel.heavy: this.DailyCalorieIntake = RestingEnergy * 1.725; break; } return(this.DailyCalorieIntake); }
internal EngineBuilder WithRestingEnergyCalculator(IRestingEnergyCalculator restingEnergyCalculator) { this.restingEnergyCalculator = restingEnergyCalculator; return(this); }