Beispiel #1
0
        public void GetFitBitActivityHistoryWithAllParams_ActivityHistoryReturned()
        {
            sut = MakeSut();
            var tokenAsJson = sut.GetFitBitAuthenticationToken();

            tokenAsJson.Value.Should().NotBeNull();
            var fitBitAuthToken = JsonConvert.DeserializeObject <FitBitAuthenticationToken>((string)tokenAsJson.Value);

            fitBitAuthToken.AccessToken.Should().NotBeNullOrEmpty();

            var startDate = DateTime.UtcNow.AddDays(-7);
            var endDate   = DateTime.UtcNow.AddDays(1);

            var activityHistory = sut.GetFitBitRecentActivities(fitBitAuthToken.AccessToken, startDate, endDate);

            Fitbit.Api.Portable.Models.ActivityLogsList actualHistory = (Fitbit.Api.Portable.Models.ActivityLogsList)activityHistory.Value;
            actualHistory.Should().NotBeNull();
            actualHistory.Should().BeOfType <Fitbit.Api.Portable.Models.ActivityLogsList>();
            actualHistory.Activities.Should().HaveCount(2);

            var alternativeActivityHistory = sut.GetFitBitRecentActivities(fitBitAuthToken.AccessToken, startDate.AddDays(7), endDate.AddDays(-31));

            Fitbit.Api.Portable.Models.ActivityLogsList alternativeActualHistory = (Fitbit.Api.Portable.Models.ActivityLogsList)alternativeActivityHistory.Value;
            alternativeActualHistory.Should().NotBeNull();
            alternativeActualHistory.Should().BeOfType <Fitbit.Api.Portable.Models.ActivityLogsList>();
            alternativeActualHistory.Activities.Should().HaveCount(0);
        }
        /// <inheritdoc/>
        public void GetRecentFitBitActivities()
        {
            var authToken                = externalAPIGateway.GetFitBitAuthenticationToken().Value;
            var actualToken              = JsonConvert.DeserializeObject <FitBitAuthenticationToken>((string)authToken);
            var searchResult             = externalAPIGateway.GetFitBitRecentActivities(actualToken.AccessToken);
            var activityHistoryContainer = (Fitbit.Api.Portable.Models.ActivityLogsList)searchResult.Value;

            foreach (var activity in activityHistoryContainer.Activities)
            {
                searchResults.Add(activity);
            }
        }
Beispiel #3
0
        public void GetFitBitActivityHistory_ActivityHistoryReturned()
        {
            sut = MakeSut();
            var tokenAsJson = sut.GetFitBitAuthenticationToken();

            tokenAsJson.Value.Should().NotBeNull();
            var fitBitAuthToken = JsonConvert.DeserializeObject <FitBitAuthenticationToken>((string)tokenAsJson.Value);

            fitBitAuthToken.AccessToken.Should().NotBeNullOrEmpty();

            var activityHistory = sut.GetFitBitRecentActivities(fitBitAuthToken.AccessToken);

            Fitbit.Api.Portable.Models.ActivityLogsList actualHistory = (Fitbit.Api.Portable.Models.ActivityLogsList)activityHistory.Value;
            actualHistory.Should().NotBeNull();
            actualHistory.Should().BeOfType <Fitbit.Api.Portable.Models.ActivityLogsList>();
            actualHistory.Activities.Should().HaveCount(2);
        }