Beispiel #1
0
 public void TestInit()
 {
     _dateProvider      = Mock.Create <IDateTimeProvider>();
     _navigationService = Mock.Create <INavigationService>();
     _habitService      = Mock.Create <IHabitService>();
     _habitViewModel    = new HabitViewModel(_dateProvider, _habitService, _navigationService);
 }
Beispiel #2
0
 public CalendarController(ICalendarService calendarService, IEventService eventService, IHabitService habitService, UserManager <ApplicationUser> signInManager, IGoalService goalService)
 {
     this.calendarService = calendarService;
     this.eventService    = eventService;
     this.habitService    = habitService;
     this.signInManager   = signInManager;
     this.goalService     = goalService;
 }
Beispiel #3
0
        public HabitHandler()
        {
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
            var serviceCollection = new ServiceCollection();

            ConfigureServices(serviceCollection);
            var serviceProvider = serviceCollection.BuildServiceProvider();

            IHabitService = serviceProvider.GetService <IHabitService>();
        }
Beispiel #4
0
        public GoalService(IDeletableEntityRepository <Goal> goalRepository, IEnumParseService enumParseService, ICalendarService calendarService, IColorService colorService, IHabitService habitService)
        {
            this.enumParseService = enumParseService;
            this.goalRepository   = goalRepository;
            this.calendarService  = calendarService;
            this.colorService     = colorService;
            this.habitService     = habitService;

            this.FillEnumDescriptions();
        }
Beispiel #5
0
 public void InitializeTest()
 {
     _persistance       = Mock.Create <IPersistance>();
     _dateTime          = Mock.Create <IDateTimeProvider>();
     _navigationService = Mock.Create <INavigationService>();
     _modelFactory      = Mock.Create <IModelFactory>();
     _storage           = new HabitService
     {
         Persistance      = _persistance,
         DateTimeProvider = _dateTime,
         ModelFactory     = _modelFactory,
         Navigation       = _navigationService,
     };
     _habitViewModel = Mock.Create <IHabitViewModel>();
 }
Beispiel #6
0
        public HabitViewModel(IDateTimeProvider dateTimeProvider, IHabitService habitService, INavigationService navigation)
            : this(dateTimeProvider, habitService)
        {
            _navigation = navigation;

            // Set initial values
            CreationDate    = DateTime.Now;
            _repeatType     = RepeatType.Days;
            _habitType      = HabitType.Daylong;
            _maxRepeatsADay = 1;
            _daysToRepeat   = 21;

            Filling      = new ObservableDictionary <DateTime, int>();
            IsCreateMode = true;
        }
        public HabitProgressViewModel(IHabitService habitService, HabitViewModel habit)
        {
            _habitService  = habitService;
            Habit          = habit;
            MaxRepeatsADay = Habit.MaxRepeatsADay;
            StartDate      = Habit.StartDate;
            RepeatType     = Habit.RepeatType;
            DaysToRepeat   = Habit.DaysToRepeat;
            HabitType      = Habit.HabitType;
            Description    = Habit.Description;
            Title          = Habit.Title;
            CreationDate   = Habit.CreationDate;

            var list = Habit.Filling.ToList();

            list.Sort((p1, p2) => p1.Key > p2.Key ? 1 :
                      p1.Key == p2.Key           ? 0 : -1);
            Filling = list;
        }
Beispiel #8
0
        public HabitViewModel(IDateTimeProvider dateTimeProvider, IHabitService habitService, INavigationService navigation, IHabitModel model)
            : this(dateTimeProvider, habitService)
        {
            _navigation = navigation;

            CreationDate = model.CreationDate;
            Id           = model.Id;
            _repeatType  = model.RepeatType;
            _description = model.Description;

            if (StartDate != null && StartDate <= habitService.DateTimeProvider.Now)
            {
                if (string.IsNullOrWhiteSpace(model.Filling))
                {
                    Filling = InitFilling();
                }
                else
                {
                    Filling = new ObservableDictionary <DateTime, int>(
                        JsonConvert.DeserializeObject <Dictionary <DateTime, int> >(model.Filling));
                }
            }
            else
            {
                Filling = new ObservableDictionary <DateTime, int>();
            }


            _habitType      = model.HabitType;
            _daysToRepeat   = model.DaysToRepeat;
            _startDate      = model.StartDate;
            _title          = model.Title;
            _repeatsToday   = Filling.ContainsKey(DateTime.Today) ? Filling[DateTime.Today] : 0;
            _isRecommended  = model.IsRecommended;
            _maxRepeatsADay = model.RepeatsADay;
        }
 public GoalsController(IGoalService goalService, UserManager <ApplicationUser> userManager, IHabitService habitService)
 {
     this.goalService  = goalService;
     this.userManager  = userManager;
     this.habitService = habitService;
 }
 public DateTimeHabitController(IDateTimeService dateTimeService, IHabitService habitService)
 {
     this.dateTimeService = dateTimeService;
     this.habitService    = habitService;
 }
 public HabitsController(IHabitService _habitService)
 {
     habitService = _habitService;
 }
Beispiel #12
0
 private HabitViewModel(IDateTimeProvider dateTimeProvider, IHabitService habitService)
 {
     _dateTimeProvider = dateTimeProvider;
     _habitService     = habitService;
     _scheduleHelper   = new HabitScheduleHelper(_habitService.DateTimeProvider);
 }
Beispiel #13
0
 public EventService(DailyHabitsDataContext dataContext, IAuthService authService, IHabitService habitService)
 {
     _dataContext  = dataContext;
     _authService  = authService;
     _habitService = habitService;
 }
Beispiel #14
0
 public EventsHub(IEventService eventService, IHabitService habitService)
 {
     this.eventService = eventService;
     this.habitService = habitService;
 }
 public HabitsController(IHabitService habitService, IGoalService goalService)
 {
     this.habitService = habitService;
     this.goalService  = goalService;
 }
 public TodaysHabitsController(IHabitService habitService, IDateTimeService dateTimeService)
 {
     this.habitService    = habitService;
     this.dateTimeService = dateTimeService;
 }
Beispiel #17
0
 public HabitController(IHabitService habitService)
 {
     _habitService = habitService;
 }