Exemple #1
0
        public void ParseWorkouts()
        {
            var result = _parser.ParseWorkouts(SampleJson);

            var expectedResult = new WorkoutSummary[]
            {
                new WorkoutSummary
                {
                    WorkoutId   = "1703314241",
                    WorkoutDate = new DateTime(2016, 8, 25),
                },
                new WorkoutSummary
                {
                    WorkoutId   = "1700659904",
                    WorkoutDate = new DateTime(2016, 8, 24),
                },
                new WorkoutSummary
                {
                    WorkoutId   = "1707528353",
                    WorkoutDate = new DateTime(2016, 8, 27),
                },
                new WorkoutSummary
                {
                    WorkoutId   = "1709715236",
                    WorkoutDate = new DateTime(2016, 8, 28),
                },
                new WorkoutSummary
                {
                    WorkoutId   = "1721324126",
                    WorkoutDate = new DateTime(2016, 9, 02),
                }
            };

            result.ShouldBeEquivalentTo(expectedResult);
        }
        public void ParseWorkouts_HandlesMultipleWorkoutsPerDay()
        {
            var result = _parser.ParseWorkouts(SampleJson);

            var expectedResult = new WorkoutSummary[]
            {
                new WorkoutSummary
                {
                    WorkoutId   = "1700659904",
                    WorkoutDate = new DateTime(2016, 8, 24),
                },
                new WorkoutSummary
                {
                    WorkoutId   = "2187048605",
                    WorkoutDate = new DateTime(2017, 5, 12),
                },
                new WorkoutSummary
                {
                    WorkoutId   = "2187997814",
                    WorkoutDate = new DateTime(2017, 5, 12),
                },
                new WorkoutSummary
                {
                    WorkoutId   = "2188224920",
                    WorkoutDate = new DateTime(2017, 5, 12),
                }
            };

            result.ShouldBeEquivalentTo(expectedResult);
        }
Exemple #3
0
 public static WorkoutSummaryViewModel FromWorkoutSummary(WorkoutSummary workout)
 {
     return(new WorkoutSummaryViewModel
     {
         Id = workout.WorkoutId,
         TargetedMuscleGroup = workout.TargetedMuscleGroup,
         Date = workout.Date,
         NumberOfExercises = workout.Exercises.Count,
         CreatedByName = workout.CreatedByName,
     });
 }
 public void UpdateWorkout(WorkoutSummary workout)
 {
     workout.TargetedMuscleGroup = TargetedMuscleGroup;
     workout.Date = Date;
 }