예제 #1
0
        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();
        }
예제 #2
0
 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;
 }
예제 #3
0
 internal EngineBuilder WithDailyNutriCalc(IDailyNutriCalc dailyNutriCalc)
 {
     this.dailyNutriCalc = dailyNutriCalc;
     return(this);
 }