public async Task Test_UserObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new UserObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var user = await jsonReader.ReadObjectAsync(stream);

                user.Should().NotBeNull();
                user.Username.Should().Be("sean");
                user.IsPrivate.Should().BeFalse();
                user.Name.Should().Be("Sean Rudford");
                user.IsVIP.Should().BeTrue();
                user.IsVIP_EP.Should().BeTrue();
                user.Ids.Should().BeNull();
                user.JoinedAt.Should().HaveValue().And.Be(DateTime.Parse("2010-09-25T17:49:25.000Z").ToUniversalTime());
                user.Location.Should().Be("SF");
                user.About.Should().Be("I have all your cassette tapes.");
                user.Gender.Should().Be("male");
                user.Age.Should().Be(35);
                user.Images.Should().NotBeNull();
                user.Images.Avatar.Should().NotBeNull();
                user.Images.Avatar.Full.Should().Be("https://walter-dev.trakt.tv/images/users/000/000/001/avatars/large/0ba3f72910.jpg");
            }
        }
示例#2
0
        public async Task Test_WatchedShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new WatchedShowObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktWatchedShow = await jsonReader.ReadObjectAsync(stream);

                traktWatchedShow.Should().NotBeNull();
                traktWatchedShow.Plays.Should().Be(1);
                traktWatchedShow.LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
                traktWatchedShow.LastUpdatedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
                traktWatchedShow.ResetAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());

                traktWatchedShow.Show.Should().NotBeNull();
                traktWatchedShow.Show.Title.Should().Be("Game of Thrones");
                traktWatchedShow.Show.Year.Should().Be(2011);
                traktWatchedShow.Show.Ids.Should().NotBeNull();
                traktWatchedShow.Show.Ids.Trakt.Should().Be(1390U);
                traktWatchedShow.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktWatchedShow.Show.Ids.Tvdb.Should().Be(121361U);
                traktWatchedShow.Show.Ids.Imdb.Should().Be("tt0944947");
                traktWatchedShow.Show.Ids.Tmdb.Should().Be(1399U);
                traktWatchedShow.Show.Ids.TvRage.Should().Be(24493U);

                traktWatchedShow.WatchedSeasons.Should().BeNull();
            }
        }
        public async Task Test_EpisodeScrobblePostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new EpisodeScrobblePostResponseObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var episodeScrobbleResponse = await jsonReader.ReadObjectAsync(stream);

                episodeScrobbleResponse.Should().NotBeNull();
                episodeScrobbleResponse.Id.Should().Be(3373536623UL);
                episodeScrobbleResponse.Action.Should().Be(TraktScrobbleActionType.Stop);
                episodeScrobbleResponse.Progress.Should().Be(85.9f);
                episodeScrobbleResponse.Sharing.Should().NotBeNull();
                episodeScrobbleResponse.Sharing.Facebook.Should().BeTrue();
                episodeScrobbleResponse.Sharing.Twitter.Should().BeTrue();
                episodeScrobbleResponse.Sharing.Google.Should().BeTrue();
                episodeScrobbleResponse.Sharing.Tumblr.Should().BeTrue();
                episodeScrobbleResponse.Sharing.Medium.Should().BeTrue();
                episodeScrobbleResponse.Sharing.Slack.Should().BeTrue();
                episodeScrobbleResponse.Episode.Should().NotBeNull();
                episodeScrobbleResponse.Episode.SeasonNumber.Should().Be(1);
                episodeScrobbleResponse.Episode.Number.Should().Be(1);
                episodeScrobbleResponse.Episode.Title.Should().Be("Winter Is Coming");
                episodeScrobbleResponse.Episode.Ids.Should().NotBeNull();
                episodeScrobbleResponse.Episode.Ids.Trakt.Should().Be(73640U);
                episodeScrobbleResponse.Episode.Ids.Tvdb.Should().Be(3254641U);
                episodeScrobbleResponse.Episode.Ids.Imdb.Should().Be("tt1480055");
                episodeScrobbleResponse.Episode.Ids.Tmdb.Should().Be(63056U);
                episodeScrobbleResponse.Episode.Ids.TvRage.Should().Be(1065008299U);
                episodeScrobbleResponse.Show.Should().BeNull();
            }
        }
        public async Task Test_MovieScrobblePostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new MovieScrobblePostResponseObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var movieScrobbleResponse = await jsonReader.ReadObjectAsync(stream);

                movieScrobbleResponse.Should().NotBeNull();
                movieScrobbleResponse.Id.Should().Be(0UL);
                movieScrobbleResponse.Action.Should().BeNull();
                movieScrobbleResponse.Progress.Should().BeNull();
                movieScrobbleResponse.Sharing.Should().BeNull();
                movieScrobbleResponse.Movie.Should().BeNull();
            }
        }
        public async Task Test_UserCustomListItemsPostResponseGroupObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new UserCustomListItemsPostResponseGroupObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var customListItemsPostResponseGroup = await jsonReader.ReadObjectAsync(stream);

                customListItemsPostResponseGroup.Should().NotBeNull();
                customListItemsPostResponseGroup.Movies.Should().BeNull();
                customListItemsPostResponseGroup.Shows.Should().BeNull();
                customListItemsPostResponseGroup.Seasons.Should().BeNull();
                customListItemsPostResponseGroup.Episodes.Should().BeNull();
                customListItemsPostResponseGroup.People.Should().BeNull();
            }
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var userAccountSettings = await jsonReader.ReadObjectAsync(stream);

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().BeNull();
                userAccountSettings.Time24Hr.Should().BeNull();
                userAccountSettings.CoverImage.Should().BeNull();
                userAccountSettings.Token.Should().BeNull();
                userAccountSettings.DateFormat.Should().BeNull();
            }
        }
示例#7
0
        public async Task Test_EpisodeIdsObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var traktJsonReader = new EpisodeIdsObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktEpisodeIds = await traktJsonReader.ReadObjectAsync(stream);

                traktEpisodeIds.Should().NotBeNull();
                traktEpisodeIds.Trakt.Should().Be(0);
                traktEpisodeIds.Tvdb.Should().BeNull();
                traktEpisodeIds.Imdb.Should().BeNull();
                traktEpisodeIds.Tmdb.Should().BeNull();
                traktEpisodeIds.TvRage.Should().BeNull();
            }
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktMovieRelease = await traktJsonReader.ReadObjectAsync(stream);

                traktMovieRelease.Should().NotBeNull();
                traktMovieRelease.CountryCode.Should().BeNull();
                traktMovieRelease.Certification.Should().BeNull();
                traktMovieRelease.ReleaseDate.Should().BeNull();
                traktMovieRelease.ReleaseType.Should().BeNull();
                traktMovieRelease.Note.Should().BeNull();
            }
        }
        public async Task Test_EpisodeCheckinPostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new EpisodeCheckinPostResponseObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var checkinEpisodeResponse = await jsonReader.ReadObjectAsync(stream);

                checkinEpisodeResponse.Should().NotBeNull();
                checkinEpisodeResponse.Id.Should().Be(0UL);
                checkinEpisodeResponse.WatchedAt.Should().BeNull();
                checkinEpisodeResponse.Sharing.Should().BeNull();
                checkinEpisodeResponse.Episode.Should().BeNull();
                checkinEpisodeResponse.Show.Should().BeNull();
            }
        }
示例#10
0
        public async Task Test_DeviceObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var objectJsonReader = new DeviceObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                ITraktDevice traktDevice = await objectJsonReader.ReadObjectAsync(stream);

                traktDevice.Should().NotBeNull();
                traktDevice.DeviceCode.Should().BeNull();
                traktDevice.UserCode.Should().BeNull();
                traktDevice.VerificationUrl.Should().BeNull();
                traktDevice.ExpiresInSeconds.Should().Be(0);
                traktDevice.IntervalInSeconds.Should().Be(0);
            }
        }
        public async Task Test_MetadataObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var traktJsonReader = new MetadataObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktMetadata = await traktJsonReader.ReadObjectAsync(stream);

                traktMetadata.Should().NotBeNull();
                traktMetadata.MediaType.Should().BeNull();
                traktMetadata.MediaResolution.Should().BeNull();
                traktMetadata.Audio.Should().BeNull();
                traktMetadata.AudioChannels.Should().BeNull();
                traktMetadata.ThreeDimensional.Should().BeNull();
            }
        }
        public async Task Test_SharingObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var traktJsonReader = new SharingObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktSharing = await traktJsonReader.ReadObjectAsync(stream);

                traktSharing.Should().NotBeNull();
                traktSharing.Twitter.Should().BeNull();
                traktSharing.Google.Should().BeNull();
                traktSharing.Tumblr.Should().BeNull();
                traktSharing.Medium.Should().BeNull();
                traktSharing.Slack.Should().BeNull();
            }
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktMostPWCShow = await traktJsonReader.ReadObjectAsync(stream);

                traktMostPWCShow.Should().NotBeNull();
                traktMostPWCShow.WatcherCount.Should().BeNull();
                traktMostPWCShow.PlayCount.Should().BeNull();
                traktMostPWCShow.CollectedCount.Should().BeNull();
                traktMostPWCShow.CollectorCount.Should().BeNull();
                traktMostPWCShow.Show.Should().BeNull();
            }
        }
示例#14
0
        public async Task Test_SyncEpisodesLastActivitiesObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new SyncEpisodesLastActivitiesObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var episodesLastActivities = await jsonReader.ReadObjectAsync(stream);

                episodesLastActivities.Should().NotBeNull();
                episodesLastActivities.WatchedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.305Z").ToUniversalTime());
                episodesLastActivities.CollectedAt.Should().Be(DateTime.Parse("2014-11-19T22:02:41.308Z").ToUniversalTime());
                episodesLastActivities.RatedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.310Z").ToUniversalTime());
                episodesLastActivities.WatchlistedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.321Z").ToUniversalTime());
                episodesLastActivities.CommentedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.325Z").ToUniversalTime());
                episodesLastActivities.PausedAt.Should().BeNull();
            }
        }
        public async Task Test_UserMoviesStatisticsObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new UserMoviesStatisticsObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var userMoviesStatistics = await jsonReader.ReadObjectAsync(stream);

                userMoviesStatistics.Should().NotBeNull();
                userMoviesStatistics.Plays.Should().Be(552);
                userMoviesStatistics.Watched.Should().Be(534);
                userMoviesStatistics.Minutes.Should().Be(17330);
                userMoviesStatistics.Collected.Should().Be(117);
                userMoviesStatistics.Ratings.Should().Be(64);
                userMoviesStatistics.Comments.Should().BeNull();
            }
        }
示例#16
0
        public async Task Test_ShowIdsObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var traktJsonReader = new ShowIdsObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktShowIds = await traktJsonReader.ReadObjectAsync(stream);

                traktShowIds.Should().NotBeNull();
                traktShowIds.Trakt.Should().Be(1390);
                traktShowIds.Slug.Should().Be("game-of-thrones");
                traktShowIds.Tvdb.Should().Be(121361U);
                traktShowIds.Imdb.Should().Be("tt0944947");
                traktShowIds.Tmdb.Should().Be(1399U);
                traktShowIds.TvRage.Should().BeNull();
            }
        }
示例#17
0
        public async Task Test_StatisticsObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var traktJsonReader = new StatisticsObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktStatistics = await traktJsonReader.ReadObjectAsync(stream);

                traktStatistics.Should().NotBeNull();
                traktStatistics.Watchers.Should().Be(129920);
                traktStatistics.Plays.Should().Be(3563853);
                traktStatistics.Collectors.Should().Be(49711);
                traktStatistics.CollectedEpisodes.Should().Be(1310350);
                traktStatistics.Comments.Should().Be(96);
                traktStatistics.Lists.Should().BeNull();
                traktStatistics.Votes.Should().Be(9274);
            }
        }
示例#18
0
        public async Task Test_AuthorizationObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var objectJsonReader = new AuthorizationObjectJsonReader
            {
                CompleteDeserialization = true
            };

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                ITraktAuthorization traktAuthorization = await objectJsonReader.ReadObjectAsync(stream);

                traktAuthorization.Should().NotBeNull();
                traktAuthorization.AccessToken.Should().Be("mockAccessToken");
                traktAuthorization.RefreshToken.Should().Be("mockRefreshToken");
                traktAuthorization.Scope.Should().Be(TraktAccessScope.Public);
                traktAuthorization.ExpiresInSeconds.Should().Be(7200U);
                traktAuthorization.TokenType.Should().Be(TraktAccessTokenType.Bearer);
                traktAuthorization.CreatedAtTimestamp.Should().Be(0);
                traktAuthorization.IgnoreExpiration.Should().BeTrue();
            }
        }