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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public async Task <IEnumerable <WorkoutSummary> > GetWorkoutsDoneInMonth(DateTime month)
        {
            var json = await mHttpClient.GetStringAsync($"{WebsiteUrl}/workouts/dashboard.json?month={month.Month}&year={month.Year}");

            return(mDashboardParser.ParseWorkouts(json).OrderBy(x => x.WorkoutDate));
        }