示例#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();
        }
 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 SetupTrackedGoalsStartable(IGoalFactory goalFactory,
     IGoalTrackingService goalTrackingService)
 {
     _goalFactory = goalFactory;
     _goalTrackingService = goalTrackingService;
 }
 internal EngineBuilder WithGoalFactory(IGoalFactory goalFactory)
 {
     this.goalFactory = goalFactory;
     return(this);
 }