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

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

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

                statistics[0].Should().NotBeNull();
                statistics[0].Watchers.Should().BeNull();
                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);
            }
        }
Ejemplo n.º 2
0
        public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new CollectionShowObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var traktCollectionShow = await jsonReader.ReadObjectAsync(stream);

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

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

                traktCollectionShow.CollectionSeasons.Should().BeNull();
            }
        }
Ejemplo n.º 3
0
        public async Task Test_UserCustomListsReorderPostResponseArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new UserCustomListsReorderPostResponseArrayJsonReader();

            using (var stream = JSON_NOT_VALID_3.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().BeNull();
                userCustomListsReorderPosts[1].SkippedIds.Should().NotBeNull().And.HaveCount(1);
                userCustomListsReorderPosts[1].SkippedIds.Should().BeEquivalentTo(new List <uint> {
                    2
                });
            }
        }
Ejemplo n.º 4
0
        public async Task Test_CommentLikeArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktCommentLike>();

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

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

                commentLikes[0].Should().NotBeNull();
                commentLikes[0].LikedAt.Should().BeNull();
                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();
            }
        }
Ejemplo n.º 5
0
        public async Task Test_EpisodeIdsArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktEpisodeIds>();

            using (var stream = JSON_NOT_VALID_3.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(0);
                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();
            }
        }
Ejemplo n.º 6
0
        public async Task Test_MetadataArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktMetadata>();

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

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

                metadatas[0].Should().NotBeNull();
                metadatas[0].MediaType.Should().BeNull();
                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_EpisodeCheckinPostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new EpisodeCheckinPostResponseObjectJsonReader();

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

                checkinEpisodeResponse.Should().NotBeNull();
                checkinEpisodeResponse.Id.Should().Be(3373536620UL);
                checkinEpisodeResponse.WatchedAt.Should().Be(DateTime.Parse("2014-08-06T06:54:36.859Z").ToUniversalTime());
                checkinEpisodeResponse.Sharing.Should().BeNull();
                checkinEpisodeResponse.Episode.Should().NotBeNull();
                checkinEpisodeResponse.Episode.SeasonNumber.Should().Be(1);
                checkinEpisodeResponse.Episode.Number.Should().Be(1);
                checkinEpisodeResponse.Episode.Title.Should().Be("Winter Is Coming");
                checkinEpisodeResponse.Episode.Ids.Should().NotBeNull();
                checkinEpisodeResponse.Episode.Ids.Trakt.Should().Be(73640U);
                checkinEpisodeResponse.Episode.Ids.Tvdb.Should().Be(3254641U);
                checkinEpisodeResponse.Episode.Ids.Imdb.Should().Be("tt1480055");
                checkinEpisodeResponse.Episode.Ids.Tmdb.Should().Be(63056U);
                checkinEpisodeResponse.Episode.Ids.TvRage.Should().Be(1065008299U);
                checkinEpisodeResponse.Show.Should().NotBeNull();
                checkinEpisodeResponse.Show.Title.Should().Be("Game of Thrones");
                checkinEpisodeResponse.Show.Year.Should().Be(2011);
                checkinEpisodeResponse.Show.Ids.Should().NotBeNull();
                checkinEpisodeResponse.Show.Ids.Trakt.Should().Be(1390U);
                checkinEpisodeResponse.Show.Ids.Slug.Should().Be("game-of-thrones");
                checkinEpisodeResponse.Show.Ids.Tvdb.Should().Be(121361U);
                checkinEpisodeResponse.Show.Ids.Imdb.Should().Be("tt0944947");
                checkinEpisodeResponse.Show.Ids.Tmdb.Should().Be(1399U);
                checkinEpisodeResponse.Show.Ids.TvRage.Should().Be(24493U);
            }
        }
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktWatchedShowEpisode>();

            using (var stream = JSON_NOT_VALID_3.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().Be(1);
                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().BeNull();
            }
        }
Ejemplo n.º 9
0
        public async Task Test_CrewMemberArrayJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new CrewMemberArrayJsonReader();

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

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

                items[0].Should().NotBeNull();
                items[0].Job.Should().BeNull();
                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].Job.Should().Be("Director");
                items[1].Person.Should().BeNull();
            }
        }
        public async Task Test_UserObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new UserObjectJsonReader();

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

                user.Should().NotBeNull();
                user.Username.Should().Be("sean");
                user.IsPrivate.Should().BeFalse();
                user.Name.Should().BeNull();
                user.IsVIP.Should().BeTrue();
                user.IsVIP_EP.Should().BeTrue();
                user.Ids.Should().NotBeNull();
                user.Ids.Slug.Should().Be("sean");
                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");
            }
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

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

                traktMostPWCShow.Should().NotBeNull();
                traktMostPWCShow.WatcherCount.Should().Be(4992);
                traktMostPWCShow.PlayCount.Should().Be(7100);
                traktMostPWCShow.CollectedCount.Should().BeNull();
                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_MovieScrobblePostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new MovieScrobblePostResponseObjectJsonReader();

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

                movieScrobbleResponse.Should().NotBeNull();
                movieScrobbleResponse.Id.Should().Be(3373536623UL);
                movieScrobbleResponse.Action.Should().Be(TraktScrobbleActionType.Stop);
                movieScrobbleResponse.Progress.Should().BeNull();
                movieScrobbleResponse.Sharing.Should().NotBeNull();
                movieScrobbleResponse.Sharing.Twitter.Should().BeTrue();
                movieScrobbleResponse.Sharing.Google.Should().BeTrue();
                movieScrobbleResponse.Sharing.Tumblr.Should().BeTrue();
                movieScrobbleResponse.Sharing.Medium.Should().BeTrue();
                movieScrobbleResponse.Sharing.Slack.Should().BeTrue();
                movieScrobbleResponse.Movie.Should().NotBeNull();
                movieScrobbleResponse.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                movieScrobbleResponse.Movie.Year.Should().Be(2015);
                movieScrobbleResponse.Movie.Ids.Should().NotBeNull();
                movieScrobbleResponse.Movie.Ids.Trakt.Should().Be(94024U);
                movieScrobbleResponse.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                movieScrobbleResponse.Movie.Ids.Imdb.Should().Be("tt2488496");
                movieScrobbleResponse.Movie.Ids.Tmdb.Should().Be(140607U);
            }
        }
        public async Task Test_PersonShowCreditsCastItemArrayJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new ArrayJsonReader<ITraktPersonShowCreditsCastItem>();

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

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

                items[0].Should().NotBeNull();
                items[0].Characters.Should().BeNull();
                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();
            }
        }
Ejemplo n.º 14
0
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

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

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

                items[0].Should().NotBeNull();
                items[0].Job.Should().BeNull();
                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();
            }
        }
Ejemplo n.º 15
0
        public async Task Test_EpisodeTranslationArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktEpisodeTranslation>();

            using (var stream = JSON_NOT_VALID_3.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().Be("Translation Overview 2");
                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().BeNull();
            }
        }
        public async Task Test_UserCustomListItemsPostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new UserCustomListItemsPostResponseObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var customListItemsPostResponse = await jsonReader.ReadObjectAsync(stream);

                customListItemsPostResponse.Should().NotBeNull();

                customListItemsPostResponse.Added.Should().NotBeNull();
                customListItemsPostResponse.Added.Movies.Should().Be(1);
                customListItemsPostResponse.Added.Shows.Should().Be(2);
                customListItemsPostResponse.Added.Seasons.Should().Be(3);
                customListItemsPostResponse.Added.Episodes.Should().Be(4);
                customListItemsPostResponse.Added.People.Should().Be(5);

                customListItemsPostResponse.Existing.Should().NotBeNull();
                customListItemsPostResponse.Existing.Movies.Should().Be(1);
                customListItemsPostResponse.Existing.Shows.Should().Be(2);
                customListItemsPostResponse.Existing.Seasons.Should().Be(3);
                customListItemsPostResponse.Existing.Episodes.Should().Be(4);
                customListItemsPostResponse.Existing.People.Should().Be(5);

                customListItemsPostResponse.NotFound.Should().BeNull();
            }
        }
        public async Task Test_SeasonWatchedProgressObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new SeasonWatchedProgressObjectJsonReader();

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

                traktSeasonWatchedProgress.Should().NotBeNull();
                traktSeasonWatchedProgress.Number.Should().Be(2);
                traktSeasonWatchedProgress.Aired.Should().Be(3);
                traktSeasonWatchedProgress.Completed.Should().BeNull();
                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());
            }
        }
Ejemplo n.º 18
0
        public async Task Test_SharingArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktSharing>();

            using (var stream = JSON_NOT_VALID_3.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().BeNull();
                sharings[1].Google.Should().BeTrue();
                sharings[1].Tumblr.Should().BeTrue();
                sharings[1].Medium.Should().BeTrue();
                sharings[1].Slack.Should().BeTrue();
            }
        }
Ejemplo n.º 19
0
        public async Task Test_EpisodeCollectionProgressArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktEpisodeCollectionProgress>();

            using (var stream = JSON_NOT_VALID_3.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().BeTrue();
                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().BeNull();
            }
        }
        public async Task Test_IdsArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktIds>();

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

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

                ids[0].Should().NotBeNull();
                ids[0].Trakt.Should().Be(0);
                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);
            }
        }
        public async Task Test_CalendarMovieArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktCalendarMovie>();

            using (var stream = JSON_NOT_VALID_3.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().BeNull();
                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);
            }
        }
        public async Task Test_CastMemberArrayJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktCastMember>();

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

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

                items[0].Should().NotBeNull();
                items[0].Characters.Should().BeNull();
                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].Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Jules Winfield");
                items[1].Person.Should().BeNull();
            }
        }
        public async Task Test_PersonMovieCreditsCrewItemArrayJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktPersonMovieCreditsCrewItem>();

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

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

                items[0].Should().NotBeNull();
                items[0].Jobs.Should().BeNull();
                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_UserStatisticsObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var userStatistics = await jsonReader.ReadObjectAsync(stream);

                userStatistics.Should().NotBeNull();

                userStatistics.Movies.Should().NotBeNull();
                userStatistics.Movies.Plays.Should().Be(552);
                userStatistics.Movies.Watched.Should().Be(534);
                userStatistics.Movies.Minutes.Should().Be(17330);
                userStatistics.Movies.Collected.Should().Be(117);
                userStatistics.Movies.Ratings.Should().Be(64);
                userStatistics.Movies.Comments.Should().Be(14);

                userStatistics.Shows.Should().NotBeNull();
                userStatistics.Shows.Watched.Should().Be(534);
                userStatistics.Shows.Collected.Should().Be(117);
                userStatistics.Shows.Ratings.Should().Be(64);
                userStatistics.Shows.Comments.Should().Be(14);

                userStatistics.Seasons.Should().BeNull();

                userStatistics.Episodes.Should().NotBeNull();
                userStatistics.Episodes.Plays.Should().Be(552);
                userStatistics.Episodes.Watched.Should().Be(534);
                userStatistics.Episodes.Minutes.Should().Be(17330);
                userStatistics.Episodes.Collected.Should().Be(117);
                userStatistics.Episodes.Ratings.Should().Be(64);
                userStatistics.Episodes.Comments.Should().Be(14);

                userStatistics.Network.Should().NotBeNull();
                userStatistics.Network.Friends.Should().Be(1);
                userStatistics.Network.Followers.Should().Be(4);
                userStatistics.Network.Following.Should().Be(11);

                userStatistics.Ratings.Should().NotBeNull();
                userStatistics.Ratings.Total.Should().Be(9257);
                userStatistics.Ratings.Distribution.Should().NotBeNull();
                userStatistics.Ratings.Distribution.Should().NotBeEmpty();
                userStatistics.Ratings.Distribution.Should().HaveCount(10);
                userStatistics.Ratings.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
                });
            }
        }
        public async Task Test_CalendarShowArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktCalendarShow>();

            using (var stream = JSON_NOT_VALID_3.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().BeNull();
                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);
            }
        }
        public async Task Test_CommentArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktComment>();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                IEnumerable <ITraktComment> traktComments = await jsonReader.ReadArrayAsync(stream);

                traktComments.Should().NotBeNull();
                ITraktComment[] comments = traktComments.ToArray();

                comments[0].Should().NotBeNull();
                comments[0].Id.Should().Be(0U);
                comments[0].ParentId.Should().Be(1234U);
                comments[0].CreatedAt.Should().Be(DateTime.Parse("2016-04-01T12:44:40Z").ToUniversalTime());
                comments[0].UpdatedAt.Should().Be(DateTime.Parse("2016-04-03T08:23:38Z").ToUniversalTime());
                comments[0].Comment.Should().Be("I hate they made The flash a kids show. Could else be much better. And with a better flash offcourse.");
                comments[0].Spoiler.Should().BeFalse();
                comments[0].Review.Should().BeFalse();
                comments[0].Replies.Should().Be(1);
                comments[0].Likes.Should().Be(2);
                comments[0].UserRating.Should().Be(7.3f);
                comments[0].User.Should().NotBeNull();
                comments[0].User.Username.Should().Be("sean");
                comments[0].User.IsPrivate.Should().BeFalse();
                comments[0].User.Name.Should().Be("Sean Rudford");
                comments[0].User.IsVIP.Should().BeTrue();
                comments[0].User.IsVIP_EP.Should().BeTrue();
                comments[0].User.Ids.Should().NotBeNull();
                comments[0].User.Ids.Slug.Should().Be("sean");

                comments[1].Should().NotBeNull();
                comments[1].Id.Should().Be(0U);
                comments[1].ParentId.Should().Be(1234U);
                comments[1].CreatedAt.Should().Be(DateTime.Parse("2016-04-01T12:44:40Z").ToUniversalTime());
                comments[1].UpdatedAt.Should().Be(DateTime.Parse("2016-04-03T08:23:38Z").ToUniversalTime());
                comments[1].Comment.Should().Be("I hate they made The flash a kids show. Could else be much better. And with a better flash offcourse.");
                comments[1].Spoiler.Should().BeFalse();
                comments[1].Review.Should().BeFalse();
                comments[1].Replies.Should().Be(1);
                comments[1].Likes.Should().Be(2);
                comments[1].UserRating.Should().Be(7.3f);
                comments[1].User.Should().NotBeNull();
                comments[1].User.Username.Should().Be("sean");
                comments[1].User.IsPrivate.Should().BeFalse();
                comments[1].User.Name.Should().Be("Sean Rudford");
                comments[1].User.IsVIP.Should().BeTrue();
                comments[1].User.IsVIP_EP.Should().BeTrue();
                comments[1].User.Ids.Should().NotBeNull();
                comments[1].User.Ids.Slug.Should().Be("sean");
            }
        }
        public async Task Test_RatingArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var jsonReader = new ArrayJsonReader <ITraktRating>();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                IEnumerable <ITraktRating> traktRatings = await jsonReader.ReadArrayAsync(stream);

                traktRatings.Should().NotBeNull();
                ITraktRating[] ratings = traktRatings.ToArray();

                ratings[0].Should().NotBeNull();
                ratings[0].Rating.Should().BeNull();
                ratings[0].Votes.Should().Be(9274);
                ratings[0].Distribution.Should().NotBeNull();
                ratings[0].Distribution.Should().NotBeEmpty();
                ratings[0].Distribution.Should().HaveCount(10);
                ratings[0].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
                });

                ratings[1].Should().NotBeNull();
                ratings[1].Rating.Should().BeNull();
                ratings[1].Votes.Should().Be(9274);
                ratings[1].Distribution.Should().NotBeNull();
                ratings[1].Distribution.Should().NotBeEmpty();
                ratings[1].Distribution.Should().HaveCount(10);
                ratings[1].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
                });
            }
        }
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new CollectionShowSeasonObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var traktCollectionShowSeason = await jsonReader.ReadObjectAsync(stream);

                traktCollectionShowSeason.Should().NotBeNull();
                traktCollectionShowSeason.Number.Should().BeNull();
                traktCollectionShowSeason.Episodes.Should().BeNull();
            }
        }
Ejemplo n.º 29
0
        public async Task Test_UserCustomListItemsRemovePostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new UserCustomListItemsRemovePostResponseObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var customListItemsRemovePostResponse = await jsonReader.ReadObjectAsync(stream);

                customListItemsRemovePostResponse.Should().NotBeNull();
                customListItemsRemovePostResponse.Deleted.Should().BeNull();
                customListItemsRemovePostResponse.NotFound.Should().BeNull();
            }
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var traktShowAlias = await traktJsonReader.ReadObjectAsync(stream);

                traktShowAlias.Should().NotBeNull();
                traktShowAlias.Title.Should().BeNull();
                traktShowAlias.CountryCode.Should().BeNull();
            }
        }