public async Task Test_StatisticsArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktStatistics>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktStatistics> traktStatisticss = await jsonReader.ReadArrayAsync(stream);

                traktStatisticss.Should().NotBeNull();
                ITraktStatistics[] statistics = traktStatisticss.ToArray();

                statistics[0].Should().NotBeNull();
                statistics[0].Watchers.Should().Be(129920);
                statistics[0].Plays.Should().Be(3563853);
                statistics[0].Collectors.Should().Be(49711);
                statistics[0].CollectedEpisodes.Should().Be(1310350);
                statistics[0].Comments.Should().Be(96);
                statistics[0].Lists.Should().Be(49468);
                statistics[0].Votes.Should().Be(9274);

                statistics[1].Should().NotBeNull();
                statistics[1].Watchers.Should().BeNull();
                statistics[1].Plays.Should().Be(3563853);
                statistics[1].Collectors.Should().Be(49711);
                statistics[1].CollectedEpisodes.Should().Be(1310350);
                statistics[1].Comments.Should().Be(96);
                statistics[1].Lists.Should().Be(49468);
                statistics[1].Votes.Should().Be(9274);
            }
        }
示例#2
0
        public async Task Test_AuthorizationArrayJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var objectJsonReader = new AuthorizationArrayJsonReader
            {
                CompleteDeserialization = true
            };

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktAuthorization> traktAuthorizations = await objectJsonReader.ReadArrayAsync(stream);

                traktAuthorizations.Should().NotBeNull();
                ITraktAuthorization[] items = traktAuthorizations.ToArray();

                items[0].Should().NotBeNull();
                items[0].AccessToken.Should().Be("mockAccessToken1");
                items[0].RefreshToken.Should().Be("mockRefreshToken1");
                items[0].Scope.Should().Be(TraktAccessScope.Public);
                items[0].ExpiresInSeconds.Should().Be(7200U);
                items[0].TokenType.Should().Be(TraktAccessTokenType.Bearer);
                items[0].CreatedAtTimestamp.Should().Be(1506271312UL);
                items[0].IgnoreExpiration.Should().BeTrue();

                items[1].Should().NotBeNull();
                items[1].AccessToken.Should().BeNull();
                items[1].RefreshToken.Should().BeNull();
                items[1].Scope.Should().BeNull();
                items[1].ExpiresInSeconds.Should().Be(0);
                items[1].TokenType.Should().BeNull();
                items[1].CreatedAtTimestamp.Should().Be(0);
                items[1].IgnoreExpiration.Should().BeFalse();
            }
        }
示例#3
0
        public async Task Test_CertificationsArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktCertifications>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktCertifications> multipleTraktCertifications = await jsonReader.ReadArrayAsync(stream);

                multipleTraktCertifications.Should().NotBeNull();
                ITraktCertifications[] traktCertifications = multipleTraktCertifications.ToArray();

                traktCertifications[0].Should().NotBeNull();
                traktCertifications[0].US.Should().NotBeNull();
                traktCertifications[0].US.Should().NotBeEmpty().And.HaveCount(2);

                ITraktCertification[] certifications = traktCertifications[0].US.ToArray();

                certifications[0].Should().NotBeNull();
                certifications[0].Name.Should().Be("PG");
                certifications[0].Slug.Should().Be("pg");
                certifications[0].Description.Should().Be("Parental Guidance Suggested");

                certifications[1].Should().NotBeNull();
                certifications[1].Name.Should().Be("PG-13");
                certifications[1].Slug.Should().Be("pg-13");
                certifications[1].Description.Should().Be("Parents Strongly Cautioned - Ages 13+ Recommended");

                traktCertifications[1].Should().NotBeNull();
                traktCertifications[1].US.Should().BeNull();
            }
        }
示例#4
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var userFollowRequest = await jsonReader.ReadObjectAsync(stream);

                userFollowRequest.Should().NotBeNull();
                userFollowRequest.Id.Should().Be(12345U);
                userFollowRequest.RequestedAt.Should().BeNull();

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

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktSharing> traktSharings = await jsonReader.ReadArrayAsync(stream);

                traktSharings.Should().NotBeNull();
                ITraktSharing[] sharings = traktSharings.ToArray();

                sharings[0].Should().NotBeNull();
                sharings[0].Twitter.Should().BeNull();
                sharings[0].Google.Should().BeTrue();
                sharings[0].Tumblr.Should().BeTrue();
                sharings[0].Medium.Should().BeTrue();
                sharings[0].Slack.Should().BeTrue();

                sharings[1].Should().NotBeNull();
                sharings[1].Twitter.Should().BeTrue();
                sharings[1].Google.Should().BeTrue();
                sharings[1].Tumblr.Should().BeTrue();
                sharings[1].Medium.Should().BeTrue();
                sharings[1].Slack.Should().BeTrue();
            }
        }
        public async Task Test_CrewMemberArrayJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktCrewMember>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktCrewMembers = await jsonReader.ReadArrayAsync(stream);

                traktCrewMembers.Should().NotBeNull();
                var items = traktCrewMembers.ToArray();

                items[0].Should().NotBeNull();
                items[0].Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Director");
                items[0].Person.Should().NotBeNull();
                items[0].Person.Name.Should().Be("Bryan Cranston");
                items[0].Person.Ids.Should().NotBeNull();
                items[0].Person.Ids.Trakt.Should().Be(297737U);
                items[0].Person.Ids.Slug.Should().Be("bryan-cranston");
                items[0].Person.Ids.Imdb.Should().Be("nm0186505");
                items[0].Person.Ids.Tmdb.Should().Be(17419U);
                items[0].Person.Ids.TvRage.Should().Be(1797U);

                items[1].Should().NotBeNull();
                items[1].Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Director");
                items[1].Person.Should().BeNull();
            }
        }
示例#7
0
        public async Task Test_CommentLikeArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktCommentLike>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktCommentLike> traktCommentLikes = await jsonReader.ReadArrayAsync(stream);

                traktCommentLikes.Should().NotBeNull();
                ITraktCommentLike[] commentLikes = traktCommentLikes.ToArray();

                commentLikes[0].Should().NotBeNull();
                commentLikes[0].LikedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
                commentLikes[0].User.Should().NotBeNull();
                commentLikes[0].User.Username.Should().Be("sean");
                commentLikes[0].User.IsPrivate.Should().BeFalse();
                commentLikes[0].User.Name.Should().Be("Sean Rudford");
                commentLikes[0].User.IsVIP.Should().BeTrue();
                commentLikes[0].User.IsVIP_EP.Should().BeFalse();
                commentLikes[0].User.Ids.Should().NotBeNull();
                commentLikes[0].User.Ids.Slug.Should().Be("sean");

                commentLikes[1].Should().NotBeNull();
                commentLikes[1].LikedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
                commentLikes[1].User.Should().BeNull();
            }
        }
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktWatchedShowEpisode>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktWatchedShowEpisodes = await jsonReader.ReadArrayAsync(stream);

                traktWatchedShowEpisodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3);

                var watchedShowEpisodes = traktWatchedShowEpisodes.ToArray();

                watchedShowEpisodes[0].Should().NotBeNull();
                watchedShowEpisodes[0].Number.Should().Be(1);
                watchedShowEpisodes[0].Plays.Should().Be(1);
                watchedShowEpisodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());

                watchedShowEpisodes[1].Should().NotBeNull();
                watchedShowEpisodes[1].Number.Should().Be(2);
                watchedShowEpisodes[1].Plays.Should().BeNull();
                watchedShowEpisodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());

                watchedShowEpisodes[2].Should().NotBeNull();
                watchedShowEpisodes[2].Number.Should().Be(3);
                watchedShowEpisodes[2].Plays.Should().Be(1);
                watchedShowEpisodes[2].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());
            }
        }
示例#9
0
        public async Task Test_PersonMovieCreditsCastItemArrayJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new PersonMovieCreditsCastItemArrayJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var movieCreditsCastItems = await jsonReader.ReadArrayAsync(stream);

                movieCreditsCastItems.Should().NotBeNull();
                var items = movieCreditsCastItems.ToArray();

                items[0].Should().NotBeNull();
                items[0].Character.Should().Be("Joe Brody");
                items[0].Movie.Should().NotBeNull();
                items[0].Movie.Title.Should().Be("Star Wars: The Force Awakens");
                items[0].Movie.Year.Should().Be(2015);
                items[0].Movie.Ids.Should().NotBeNull();
                items[0].Movie.Ids.Trakt.Should().Be(94024U);
                items[0].Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                items[0].Movie.Ids.Imdb.Should().Be("tt2488496");
                items[0].Movie.Ids.Tmdb.Should().Be(140607U);

                items[1].Should().NotBeNull();
                items[1].Character.Should().Be("Sam Flynn");
                items[1].Movie.Should().BeNull();
            }
        }
        public async Task Test_CalendarShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new CalendarShowObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktCalendarShow = await jsonReader.ReadObjectAsync(stream);

                traktCalendarShow.Should().NotBeNull();
                traktCalendarShow.FirstAiredInCalendar.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime());

                traktCalendarShow.Show.Should().BeNull();

                traktCalendarShow.Episode.Should().NotBeNull();
                traktCalendarShow.Episode.SeasonNumber.Should().Be(1);
                traktCalendarShow.Episode.Number.Should().Be(1);
                traktCalendarShow.Episode.Title.Should().Be("Winter Is Coming");
                traktCalendarShow.Episode.Ids.Should().NotBeNull();
                traktCalendarShow.Episode.Ids.Trakt.Should().Be(73640U);
                traktCalendarShow.Episode.Ids.Tvdb.Should().Be(3254641U);
                traktCalendarShow.Episode.Ids.Imdb.Should().Be("tt1480055");
                traktCalendarShow.Episode.Ids.Tmdb.Should().Be(63056U);
                traktCalendarShow.Episode.Ids.TvRage.Should().Be(1065008299U);
            }
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

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

                traktMostPWCShow.Should().NotBeNull();
                traktMostPWCShow.WatcherCount.Should().Be(4992);
                traktMostPWCShow.PlayCount.Should().BeNull();
                traktMostPWCShow.CollectedCount.Should().Be(1348);
                traktMostPWCShow.CollectorCount.Should().Be(7964);
                traktMostPWCShow.Show.Should().NotBeNull();
                traktMostPWCShow.Show.Title.Should().Be("Game of Thrones");
                traktMostPWCShow.Show.Year.Should().Be(2011);
                traktMostPWCShow.Show.Ids.Should().NotBeNull();
                traktMostPWCShow.Show.Ids.Trakt.Should().Be(1390U);
                traktMostPWCShow.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktMostPWCShow.Show.Ids.Tvdb.Should().Be(121361U);
                traktMostPWCShow.Show.Ids.Imdb.Should().Be("tt0944947");
                traktMostPWCShow.Show.Ids.Tmdb.Should().Be(1399U);
                traktMostPWCShow.Show.Ids.TvRage.Should().Be(24493U);
            }
        }
        public async Task Test_PersonShowCreditsCastItemArrayJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new ArrayJsonReader<ITraktPersonShowCreditsCastItem>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var showCreditsCastItems = await traktJsonReader.ReadArrayAsync(stream);

                showCreditsCastItems.Should().NotBeNull();
                var items = showCreditsCastItems.ToArray();

                items[0].Should().NotBeNull();
                items[0].Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
                items[0].Show.Should().NotBeNull();
                items[0].Show.Title.Should().Be("Game of Thrones");
                items[0].Show.Year.Should().Be(2011);
                items[0].Show.Ids.Should().NotBeNull();
                items[0].Show.Ids.Trakt.Should().Be(1390U);
                items[0].Show.Ids.Slug.Should().Be("game-of-thrones");
                items[0].Show.Ids.Tvdb.Should().Be(121361U);
                items[0].Show.Ids.Imdb.Should().Be("tt0944947");
                items[0].Show.Ids.Tmdb.Should().Be(1399U);
                items[0].Show.Ids.TvRage.Should().Be(24493U);

                items[1].Should().NotBeNull();
                items[1].Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Iris West");
                items[1].Show.Should().BeNull();
            }
        }
        public async Task Test_CollectionMovieObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new CollectionMovieObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktCollectionMovie = await jsonReader.ReadObjectAsync(stream);

                traktCollectionMovie.Should().NotBeNull();
                traktCollectionMovie.CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
                traktCollectionMovie.UpdatedAt.Should().BeNull();

                traktCollectionMovie.Movie.Should().NotBeNull();
                traktCollectionMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                traktCollectionMovie.Movie.Year.Should().Be(2015);
                traktCollectionMovie.Movie.Ids.Should().NotBeNull();
                traktCollectionMovie.Movie.Ids.Trakt.Should().Be(94024U);
                traktCollectionMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                traktCollectionMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
                traktCollectionMovie.Movie.Ids.Tmdb.Should().Be(140607U);

                traktCollectionMovie.Metadata.Should().NotBeNull();
                traktCollectionMovie.Metadata.MediaType.Should().Be(TraktMediaType.Bluray);
                traktCollectionMovie.Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_1080p);
                traktCollectionMovie.Metadata.Audio.Should().Be(TraktMediaAudio.DTS);
                traktCollectionMovie.Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_6_1);
                traktCollectionMovie.Metadata.ThreeDimensional.Should().BeFalse();
            }
        }
示例#14
0
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var showCreditsCrewItems = await traktJsonReader.ReadArrayAsync(stream);

                showCreditsCrewItems.Should().NotBeNull();
                var items = showCreditsCrewItems.ToArray();

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

                items[1].Should().NotBeNull();
                items[1].Job.Should().Be("Producer");
                items[1].Show.Should().BeNull();
            }
        }
示例#15
0
        public async Task Test_UserCustomListsReorderPostResponseArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new UserCustomListsReorderPostResponseArrayJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktUserCustomListsReorderPostResponse> traktUserCustomListsReorderPostResponses = await traktJsonReader.ReadArrayAsync(stream);

                traktUserCustomListsReorderPostResponses.Should().NotBeNull();
                ITraktUserCustomListsReorderPostResponse[] userCustomListsReorderPosts = traktUserCustomListsReorderPostResponses.ToArray();

                userCustomListsReorderPosts[0].Should().NotBeNull();
                userCustomListsReorderPosts[0].Updated.Should().BeNull();
                userCustomListsReorderPosts[0].SkippedIds.Should().NotBeNull().And.HaveCount(1);
                userCustomListsReorderPosts[0].SkippedIds.Should().BeEquivalentTo(new List <uint> {
                    2
                });

                userCustomListsReorderPosts[1].Should().NotBeNull();
                userCustomListsReorderPosts[1].Updated.Should().Be(6);
                userCustomListsReorderPosts[1].SkippedIds.Should().NotBeNull().And.HaveCount(1);
                userCustomListsReorderPosts[1].SkippedIds.Should().BeEquivalentTo(new List <uint> {
                    2
                });
            }
        }
        public async Task Test_MovieCheckinPostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new MovieCheckinPostResponseObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var checkinMovieResponse = await jsonReader.ReadObjectAsync(stream);

                checkinMovieResponse.Should().NotBeNull();
                checkinMovieResponse.Id.Should().Be(3373536620UL);
                checkinMovieResponse.WatchedAt.Should().BeNull();
                checkinMovieResponse.Sharing.Should().NotBeNull();
                checkinMovieResponse.Sharing.Twitter.Should().BeTrue();
                checkinMovieResponse.Sharing.Google.Should().BeTrue();
                checkinMovieResponse.Sharing.Tumblr.Should().BeTrue();
                checkinMovieResponse.Sharing.Medium.Should().BeTrue();
                checkinMovieResponse.Sharing.Slack.Should().BeTrue();
                checkinMovieResponse.Movie.Should().NotBeNull();
                checkinMovieResponse.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                checkinMovieResponse.Movie.Year.Should().Be(2015);
                checkinMovieResponse.Movie.Ids.Should().NotBeNull();
                checkinMovieResponse.Movie.Ids.Trakt.Should().Be(94024U);
                checkinMovieResponse.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                checkinMovieResponse.Movie.Ids.Imdb.Should().Be("tt2488496");
                checkinMovieResponse.Movie.Ids.Tmdb.Should().Be(140607U);
            }
        }
示例#17
0
        public async Task Test_CastAndCrewArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktCastAndCrew>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktCastAndCrew> traktCastAndCrews = await jsonReader.ReadArrayAsync(stream);

                traktCastAndCrews.Should().NotBeNull();
                ITraktCastAndCrew[] items           = traktCastAndCrews.ToArray();
                ITraktCastMember[]  castMemberItems = items[0].Cast.ToArray();

                castMemberItems[0].Should().NotBeNull();
                castMemberItems[0].Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
                castMemberItems[0].Person.Should().NotBeNull();
                castMemberItems[0].Person.Name.Should().Be("Bryan Cranston");
                castMemberItems[0].Person.Ids.Should().NotBeNull();
                castMemberItems[0].Person.Ids.Trakt.Should().Be(297737U);
                castMemberItems[0].Person.Ids.Slug.Should().Be("bryan-cranston");
                castMemberItems[0].Person.Ids.Imdb.Should().Be("nm0186505");
                castMemberItems[0].Person.Ids.Tmdb.Should().Be(17419U);
                castMemberItems[0].Person.Ids.TvRage.Should().Be(1797U);

                items[1].Cast.Should().BeNull();
                items[1].Crew.Should().BeNull();
            }
        }
        public async Task Test_CastMemberArrayJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new CastMemberArrayJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktCastMembers = await jsonReader.ReadArrayAsync(stream);

                traktCastMembers.Should().NotBeNull();
                var items = traktCastMembers.ToArray();

                items[0].Should().NotBeNull();
                items[0].Character.Should().Be("Joe Brody");
                items[0].Person.Should().NotBeNull();
                items[0].Person.Name.Should().Be("Bryan Cranston");
                items[0].Person.Ids.Should().NotBeNull();
                items[0].Person.Ids.Trakt.Should().Be(297737U);
                items[0].Person.Ids.Slug.Should().Be("bryan-cranston");
                items[0].Person.Ids.Imdb.Should().Be("nm0186505");
                items[0].Person.Ids.Tmdb.Should().Be(17419U);
                items[0].Person.Ids.TvRage.Should().Be(1797U);

                items[1].Should().NotBeNull();
                items[1].Character.Should().Be("Jules Winfield");
                items[1].Person.Should().BeNull();
            }
        }
        public async Task Test_IdsArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktIds>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktIds> multipleTraktIds = await jsonReader.ReadArrayAsync(stream);

                multipleTraktIds.Should().NotBeNull();
                ITraktIds[] ids = multipleTraktIds.ToArray();

                ids[0].Should().NotBeNull();
                ids[0].Trakt.Should().Be(1390);
                ids[0].Slug.Should().Be("game-of-thrones");
                ids[0].Tvdb.Should().Be(121361U);
                ids[0].Imdb.Should().Be("tt0944947");
                ids[0].Tmdb.Should().Be(1399U);
                ids[0].TvRage.Should().Be(24493U);

                ids[1].Should().NotBeNull();
                ids[1].Trakt.Should().Be(0);
                ids[1].Slug.Should().Be("game-of-thrones");
                ids[1].Tvdb.Should().Be(121361U);
                ids[1].Imdb.Should().Be("tt0944947");
                ids[1].Tmdb.Should().Be(1399U);
                ids[1].TvRage.Should().Be(24493U);
            }
        }
示例#20
0
        public async Task Test_RatingObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new RatingObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktRating = await traktJsonReader.ReadObjectAsync(stream);

                traktRating.Should().NotBeNull();
                traktRating.Rating.Should().Be(8.32715f);
                traktRating.Votes.Should().BeNull();
                traktRating.Distribution.Should().NotBeNull();
                traktRating.Distribution.Should().NotBeEmpty();
                traktRating.Distribution.Should().HaveCount(10);
                traktRating.Distribution.Should().Contain(new Dictionary <string, int>
                {
                    ["1"]  = 78,
                    ["2"]  = 45,
                    ["3"]  = 55,
                    ["4"]  = 96,
                    ["5"]  = 183,
                    ["6"]  = 545,
                    ["7"]  = 1361,
                    ["8"]  = 2259,
                    ["9"]  = 1772,
                    ["10"] = 2863
                });
            }
        }
示例#21
0
        public async Task Test_EpisodeIdsArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktEpisodeIds>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktEpisodeIds = await traktJsonReader.ReadArrayAsync(stream);

                traktEpisodeIds.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);

                var episodeIds = traktEpisodeIds.ToArray();

                episodeIds[0].Should().NotBeNull();
                episodeIds[0].Trakt.Should().Be(73640);
                episodeIds[0].Tvdb.Should().Be(3254641U);
                episodeIds[0].Imdb.Should().Be("tt1480055");
                episodeIds[0].Tmdb.Should().Be(63056U);
                episodeIds[0].TvRage.Should().Be(1065008299U);
                episodeIds[0].HasAnyId.Should().BeTrue();

                episodeIds[1].Should().NotBeNull();
                episodeIds[1].Trakt.Should().Be(0);
                episodeIds[1].Tvdb.Should().Be(3254641U);
                episodeIds[1].Imdb.Should().Be("tt1480055");
                episodeIds[1].Tmdb.Should().Be(63056U);
                episodeIds[1].TvRage.Should().Be(1065008299U);
                episodeIds[1].HasAnyId.Should().BeTrue();
            }
        }
        public async Task Test_CalendarMovieArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktCalendarMovie>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktCalendarMovie> traktCalendarMovies = await jsonReader.ReadArrayAsync(stream);

                traktCalendarMovies.Should().NotBeNull();
                ITraktCalendarMovie[] calendarMovies = traktCalendarMovies.ToArray();

                calendarMovies[0].Should().NotBeNull();
                calendarMovies[0].CalendarRelease.Should().BeNull();
                calendarMovies[0].Movie.Should().NotBeNull();
                calendarMovies[0].Movie.Title.Should().Be("Star Wars: The Force Awakens");
                calendarMovies[0].Movie.Year.Should().Be(2015);
                calendarMovies[0].Movie.Ids.Should().NotBeNull();
                calendarMovies[0].Movie.Ids.Trakt.Should().Be(94024U);
                calendarMovies[0].Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                calendarMovies[0].Movie.Ids.Imdb.Should().Be("tt2488496");
                calendarMovies[0].Movie.Ids.Tmdb.Should().Be(140607U);

                calendarMovies[1].Should().NotBeNull();
                calendarMovies[1].CalendarRelease.Should().Be(DateTime.Parse("2014-08-01"));
                calendarMovies[1].Movie.Should().NotBeNull();
                calendarMovies[1].Movie.Title.Should().Be("Star Wars: The Force Awakens");
                calendarMovies[1].Movie.Year.Should().Be(2015);
                calendarMovies[1].Movie.Ids.Should().NotBeNull();
                calendarMovies[1].Movie.Ids.Trakt.Should().Be(94024U);
                calendarMovies[1].Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                calendarMovies[1].Movie.Ids.Imdb.Should().Be("tt2488496");
                calendarMovies[1].Movie.Ids.Tmdb.Should().Be(140607U);
            }
        }
示例#23
0
        public async Task Test_EpisodeCollectionProgressArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktEpisodeCollectionProgress>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktEpisodeCollectionProgresses = await traktJsonReader.ReadArrayAsync(stream);

                traktEpisodeCollectionProgresses.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3);

                var collectionProgress = traktEpisodeCollectionProgresses.ToArray();

                collectionProgress[0].Number.Should().Be(1);
                collectionProgress[0].Completed.Should().BeTrue();
                collectionProgress[0].CollectedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime());

                collectionProgress[1].Number.Should().Be(2);
                collectionProgress[1].Completed.Should().BeNull();
                collectionProgress[1].CollectedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime());

                collectionProgress[2].Number.Should().Be(3);
                collectionProgress[2].Completed.Should().BeTrue();
                collectionProgress[2].CollectedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime());
            }
        }
        public async Task Test_PersonMovieCreditsCrewItemArrayJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktPersonMovieCreditsCrewItem>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var movieCreditsCrewItems = await jsonReader.ReadArrayAsync(stream);

                movieCreditsCrewItems.Should().NotBeNull();
                var items = movieCreditsCrewItems.ToArray();

                items[0].Should().NotBeNull();
                items[0].Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Director");
                items[0].Movie.Should().NotBeNull();
                items[0].Movie.Title.Should().Be("Star Wars: The Force Awakens");
                items[0].Movie.Year.Should().Be(2015);
                items[0].Movie.Ids.Should().NotBeNull();
                items[0].Movie.Ids.Trakt.Should().Be(94024U);
                items[0].Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                items[0].Movie.Ids.Imdb.Should().Be("tt2488496");
                items[0].Movie.Ids.Tmdb.Should().Be(140607U);

                items[1].Should().NotBeNull();
                items[1].Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Producer");
                items[1].Movie.Should().BeNull();
            }
        }
        public async Task Test_DeviceArrayJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var objectJsonReader = new ArrayJsonReader <ITraktDevice>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktDevice> traktDevices = await objectJsonReader.ReadArrayAsync(stream);

                traktDevices.Should().NotBeNull();
                ITraktDevice[] items = traktDevices.ToArray();

                items[0].Should().NotBeNull();
                items[0].DeviceCode.Should().Be("mockDeviceCode1");
                items[0].UserCode.Should().Be("mockUserCode1");
                items[0].VerificationUrl.Should().Be("mockUrl1");
                items[0].ExpiresInSeconds.Should().Be(7200U);
                items[0].IntervalInSeconds.Should().Be(600U);

                items[1].Should().NotBeNull();
                items[1].DeviceCode.Should().BeNull();
                items[1].UserCode.Should().BeNull();
                items[1].VerificationUrl.Should().BeNull();
                items[1].ExpiresInSeconds.Should().Be(0);
                items[1].IntervalInSeconds.Should().Be(0);
            }
        }
示例#26
0
        public async Task Test_MetadataArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktMetadata>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktMetadata> traktMetadatas = await jsonReader.ReadArrayAsync(stream);

                traktMetadatas.Should().NotBeNull();
                ITraktMetadata[] metadatas = traktMetadatas.ToArray();

                metadatas[0].Should().NotBeNull();
                metadatas[0].MediaType.Should().Be(TraktMediaType.Digital);
                metadatas[0].MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                metadatas[0].Audio.Should().Be(TraktMediaAudio.AAC);
                metadatas[0].AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                metadatas[0].HDR.Should().Be(TraktMediaHDR.DolbyVision);
                metadatas[0].ThreeDimensional.Should().BeTrue();

                metadatas[1].Should().NotBeNull();
                metadatas[1].MediaType.Should().BeNull();
                metadatas[1].MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                metadatas[1].Audio.Should().Be(TraktMediaAudio.AAC);
                metadatas[1].AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                metadatas[1].HDR.Should().Be(TraktMediaHDR.DolbyVision);
                metadatas[1].ThreeDimensional.Should().BeTrue();
            }
        }
        public async Task Test_SeasonWatchedProgressObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new SeasonWatchedProgressObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktSeasonWatchedProgress = await traktJsonReader.ReadObjectAsync(stream);

                traktSeasonWatchedProgress.Should().NotBeNull();
                traktSeasonWatchedProgress.Number.Should().Be(2);
                traktSeasonWatchedProgress.Aired.Should().BeNull();
                traktSeasonWatchedProgress.Completed.Should().Be(2);
                traktSeasonWatchedProgress.Episodes.Should().NotBeNull().And.HaveCount(2);

                var episodesWatchedProgress = traktSeasonWatchedProgress.Episodes.ToArray();

                episodesWatchedProgress[0].Should().NotBeNull();
                episodesWatchedProgress[0].Number.Should().Be(1);
                episodesWatchedProgress[0].Completed.Should().BeTrue();
                episodesWatchedProgress[0].LastWatchedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime());

                episodesWatchedProgress[1].Should().NotBeNull();
                episodesWatchedProgress[1].Number.Should().Be(2);
                episodesWatchedProgress[1].Completed.Should().BeTrue();
                episodesWatchedProgress[1].LastWatchedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime());
            }
        }
示例#28
0
        public async Task Test_EpisodeTranslationArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktEpisodeTranslation>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktEpisodeTranslations = await traktJsonReader.ReadArrayAsync(stream);

                traktEpisodeTranslations.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3);

                var translations = traktEpisodeTranslations.ToArray();

                translations[0].Title.Should().Be("Translation 1");
                translations[0].Overview.Should().Be("Translation Overview 1");
                translations[0].LanguageCode.Should().Be("Translation Language 1");

                translations[1].Title.Should().Be("Translation 2");
                translations[1].Overview.Should().BeNull();
                translations[1].LanguageCode.Should().Be("Translation Language 2");

                translations[2].Title.Should().Be("Translation 3");
                translations[2].Overview.Should().Be("Translation Overview 3");
                translations[2].LanguageCode.Should().Be("Translation Language 3");
            }
        }
示例#29
0
        public async Task Test_WatchedShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new WatchedShowObjectJsonReader();

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

                traktWatchedShow.Should().NotBeNull();
                traktWatchedShow.Plays.Should().Be(1);
                traktWatchedShow.LastWatchedAt.Should().BeNull();

                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().NotBeNull().And.HaveCount(2);
                var seasons = traktWatchedShow.WatchedSeasons.ToArray();

                seasons[0].Should().NotBeNull();
                seasons[0].Number.Should().Be(1);
                seasons[0].Episodes.Should().NotBeNull().And.HaveCount(2);

                var episodes = seasons[0].Episodes.ToArray();

                episodes[0].Should().NotBeNull();
                episodes[0].Number.Should().Be(1);
                episodes[0].Plays.Should().Be(1);
                episodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());

                episodes[1].Should().NotBeNull();
                episodes[1].Number.Should().Be(2);
                episodes[1].Plays.Should().Be(1);
                episodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());

                seasons[1].Should().NotBeNull();
                seasons[1].Number.Should().Be(2);
                seasons[1].Episodes.Should().NotBeNull().And.HaveCount(2);

                episodes = seasons[1].Episodes.ToArray();

                episodes[0].Should().NotBeNull();
                episodes[0].Number.Should().Be(1);
                episodes[0].Plays.Should().Be(1);
                episodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());

                episodes[1].Should().NotBeNull();
                episodes[1].Number.Should().Be(2);
                episodes[1].Plays.Should().Be(1);
                episodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
            }
        }
        public async Task Test_CalendarShowArrayJsonReader_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktCalendarShow>();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktCalendarShow> traktCalendarShows = await jsonReader.ReadArrayAsync(stream);

                traktCalendarShows.Should().NotBeNull();
                ITraktCalendarShow[] calendarShows = traktCalendarShows.ToArray();

                calendarShows[0].Should().NotBeNull();
                calendarShows[0].FirstAiredInCalendar.Should().BeNull();
                calendarShows[0].Show.Should().NotBeNull();
                calendarShows[0].Show.Title.Should().Be("Game of Thrones");
                calendarShows[0].Show.Year.Should().Be(2011);
                calendarShows[0].Show.Ids.Should().NotBeNull();
                calendarShows[0].Show.Ids.Trakt.Should().Be(1390U);
                calendarShows[0].Show.Ids.Slug.Should().Be("game-of-thrones");
                calendarShows[0].Show.Ids.Tvdb.Should().Be(121361U);
                calendarShows[0].Show.Ids.Imdb.Should().Be("tt0944947");
                calendarShows[0].Show.Ids.Tmdb.Should().Be(1399U);
                calendarShows[0].Show.Ids.TvRage.Should().Be(24493U);
                calendarShows[0].Episode.Should().NotBeNull();
                calendarShows[0].Episode.SeasonNumber.Should().Be(1);
                calendarShows[0].Episode.Number.Should().Be(1);
                calendarShows[0].Episode.Title.Should().Be("Winter Is Coming");
                calendarShows[0].Episode.Ids.Should().NotBeNull();
                calendarShows[0].Episode.Ids.Trakt.Should().Be(73640U);
                calendarShows[0].Episode.Ids.Tvdb.Should().Be(3254641U);
                calendarShows[0].Episode.Ids.Imdb.Should().Be("tt1480055");
                calendarShows[0].Episode.Ids.Tmdb.Should().Be(63056U);
                calendarShows[0].Episode.Ids.TvRage.Should().Be(1065008299U);

                calendarShows[1].Should().NotBeNull();
                calendarShows[1].FirstAiredInCalendar.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime());
                calendarShows[1].Show.Should().NotBeNull();
                calendarShows[1].Show.Title.Should().Be("Game of Thrones");
                calendarShows[1].Show.Year.Should().Be(2011);
                calendarShows[1].Show.Ids.Should().NotBeNull();
                calendarShows[1].Show.Ids.Trakt.Should().Be(1390U);
                calendarShows[1].Show.Ids.Slug.Should().Be("game-of-thrones");
                calendarShows[1].Show.Ids.Tvdb.Should().Be(121361U);
                calendarShows[1].Show.Ids.Imdb.Should().Be("tt0944947");
                calendarShows[1].Show.Ids.Tmdb.Should().Be(1399U);
                calendarShows[1].Show.Ids.TvRage.Should().Be(24493U);
                calendarShows[1].Episode.Should().NotBeNull();
                calendarShows[1].Episode.SeasonNumber.Should().Be(1);
                calendarShows[1].Episode.Number.Should().Be(1);
                calendarShows[1].Episode.Title.Should().Be("Winter Is Coming");
                calendarShows[1].Episode.Ids.Should().NotBeNull();
                calendarShows[1].Episode.Ids.Trakt.Should().Be(73640U);
                calendarShows[1].Episode.Ids.Tvdb.Should().Be(3254641U);
                calendarShows[1].Episode.Ids.Imdb.Should().Be("tt1480055");
                calendarShows[1].Episode.Ids.Tmdb.Should().Be(63056U);
                calendarShows[1].Episode.Ids.TvRage.Should().Be(1065008299U);
            }
        }