public DailyWorkoutsController(IDailyWorkoutService dailyWorkotuService,
                                UserManager <ApplicationUser> userManager,
                                IHttpContextAccessor accessor,
                                WorkoutContext cotnext)
     : base(userManager, accessor, cotnext)
 {
     _dailyWorkoutService = dailyWorkotuService;
 }
Beispiel #2
0
 public ScheduleController(IMapper mapper, IWeekScheduleService weekScheduleService, IWorkoutInformationService workoutInformationService, IDailyWorkoutService dailyWorkoutService, IModelViewFactory modelViewFactory)
 {
     this.mapper = mapper ?? throw new ArgumentException("Mapper cannot be null");
     this.weekScheduleService       = weekScheduleService ?? throw new ArgumentException("weekScheduleService cannot be null");
     this.workoutInformationService = workoutInformationService ?? throw new ArgumentException("workoutInformationService cannot be null");
     this.dailyWorkoutService       = dailyWorkoutService ?? throw new ArgumentException("dailyWorkoutService cannot be null");
     this.modelViewFactory          = modelViewFactory ?? throw new ArgumentException("modelViewFactory cannot be null");
 }
Beispiel #3
0
 public WorkoutController(IMapper mapper, IWorkoutInformationService workoutInformationService, IWeekScheduleService weekScheduleService, IDatetimeProvider datetimeProvider, IDailyWorkoutService dailyWorkoutService, IMemberIdProvider memberIdProvider, IMemberService memberService, IWorkoutService workoutService, IModelViewFactory modelViewFactory, IDataModelFactory dataModelFactory)
 {
     this.mapper = mapper ?? throw new ArgumentException("Mapper cannot be null");
     this.workoutInformationService = workoutInformationService ?? throw new ArgumentException("workoutInformationService cannot be null");
     this.weekScheduleService       = weekScheduleService ?? throw new ArgumentException("weekScheduleService cannot be null");
     this.datetimeProvider          = datetimeProvider ?? throw new ArgumentException("datetimeProvider cannot be null");
     this.dailyWorkoutService       = dailyWorkoutService ?? throw new ArgumentException("dailyWorkoutService cannot be null");
     this.memberIdProvider          = memberIdProvider ?? throw new ArgumentException("memberIdProvider cannot be null");
     this.memberService             = memberService ?? throw new ArgumentException("memberService cannot be null");
     this.workoutService            = workoutService ?? throw new ArgumentException("workoutService cannot be null");
     this.modelViewFactory          = modelViewFactory ?? throw new ArgumentException("modelViewFactory cannot be null");
     this.dataModelFactory          = dataModelFactory ?? throw new ArgumentException("dataModelFactory cannot be null");
 }
        public static void Init(TestContext c)
        {
            var options = new DbContextOptionsBuilder <WorkoutContext>()
                          .UseInMemoryDatabase()
                          .Options;
            var optionsExercise = new DbContextOptionsBuilder <ExerciseContext>()
                                  .UseInMemoryDatabase()
                                  .Options;
            var context  = new ExerciseContext(optionsExercise);
            var _context = new WorkoutContext(options, true);

            _dailyWorkoutService = new DailyWorkoutService(_context,
                                                           context);
            if (_context.Users.Count() != 0)
            {
                foreach (ApplicationUser u in _context.Users)
                {
                    _context.Users.Remove(u);
                }
            }
            if (_context.DailyWorkouts.Count() != 0)
            {
                foreach (DailyWorkout u in _context.DailyWorkouts)
                {
                    _context.DailyWorkouts.Remove(u);
                }
            }
            if (_context.WeeklyWorkouts.Count() != 0)
            {
                foreach (WeeklyWorkout u in _context.WeeklyWorkouts)
                {
                    _context.WeeklyWorkouts.Remove(u);
                }
            }
            if (_context.MonthlyWorkouts.Count() != 0)
            {
                foreach (MonthlyWorkout u in _context.MonthlyWorkouts)
                {
                    _context.MonthlyWorkouts.Remove(u);
                }
            }
            _testUser = new ApplicationUser()
            {
                Email         = "*****@*****.**",
                DailyWorkouts = new List <DailyWorkout>()
            };
            _context.Users.Add(_testUser);
        }