public async Task Test_CrewArrayJsonReader_ReadArray_From_Stream_Complete()
        {
            var jsonReader = new ArrayJsonReader <ITraktCrew>();

            using (var stream = JSON_COMPLETE.ToStream())
            {
                IEnumerable <ITraktCrew> traktCrews = await jsonReader.ReadArrayAsync(stream);

                traktCrews.Should().NotBeNull();
                ITraktCrew[] crews = traktCrews.ToArray();

                crews[0].Production.Should().NotBeNull().And.HaveCount(1);
                ITraktCrewMember[] productionCrew = crews[0].Production.ToArray();

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

                crews[0].Art.Should().BeNull();
                crews[0].Crew.Should().BeNull();
                crews[0].CostumeAndMakeup.Should().BeNull();
                crews[0].Directing.Should().BeNull();
                crews[0].Writing.Should().BeNull();
                crews[0].Sound.Should().BeNull();
                crews[0].Camera.Should().BeNull();
                crews[0].Lighting.Should().BeNull();
                crews[0].VisualEffects.Should().BeNull();
                crews[0].Editing.Should().BeNull();

                crews[1].Production.Should().NotBeNull().And.HaveCount(1);
                productionCrew = crews[1].Production.ToArray();

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

                crews[1].Art.Should().BeNull();
                crews[1].Crew.Should().BeNull();
                crews[1].CostumeAndMakeup.Should().BeNull();
                crews[1].Directing.Should().BeNull();
                crews[1].Writing.Should().BeNull();
                crews[1].Sound.Should().BeNull();
                crews[1].Camera.Should().BeNull();
                crews[1].Lighting.Should().BeNull();
                crews[1].VisualEffects.Should().BeNull();
                crews[1].Editing.Should().BeNull();
            }
        }
Exemplo n.º 2
0
 public async Task Test_RecommendationArrayJsonReader_ReadArray_From_Json_String_Null()
 {
     var jsonReader = new ArrayJsonReader <ITraktRecommendation>();
     Func <Task <IEnumerable <ITraktRecommendation> > > traktRecommendations = () => jsonReader.ReadArrayAsync(default(string));
     await traktRecommendations.Should().ThrowAsync <ArgumentNullException>();
 }
Exemplo n.º 3
0
 public async Task Test_SharingArrayJsonReader_ReadArray_From_JsonReader_Null()
 {
     var traktJsonReader = new ArrayJsonReader <ITraktSharing>();
     Func <Task <IEnumerable <ITraktSharing> > > traktSharings = () => traktJsonReader.ReadArrayAsync(default(JsonTextReader));
     await traktSharings.Should().ThrowAsync <ArgumentNullException>();
 }
Exemplo n.º 4
0
        public override async Task <ITraktCrew> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            CheckJsonTextReader(jsonReader);

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                var        crewMembersReader = new ArrayJsonReader <ITraktCrewMember>();
                ITraktCrew traktCrew         = new TraktCrew();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.PROPERTY_NAME_PRODUCTION:
                        traktCrew.Production = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_ART:
                        traktCrew.Art = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_CREW:
                        traktCrew.Crew = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_COSTUME_AND_MAKE_UP:
                        traktCrew.CostumeAndMakeup = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_DIRECTING:
                        traktCrew.Directing = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_WRITING:
                        traktCrew.Writing = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_SOUND:
                        traktCrew.Sound = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_CAMERA:
                        traktCrew.Camera = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_LIGHTING:
                        traktCrew.Lighting = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_VISUAL_EFFECTS:
                        traktCrew.VisualEffects = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_EDITING:
                        traktCrew.Editing = await crewMembersReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(traktCrew);
            }

            return(await Task.FromResult(default(ITraktCrew)));
        }
 public async Task Test_PostResponseNotFoundSeasonArrayJsonReader_ReadArray_From_Stream_Null()
 {
     var jsonReader = new ArrayJsonReader <ITraktPostResponseNotFoundSeason>();
     Func <Task <IEnumerable <ITraktPostResponseNotFoundSeason> > > notFoundSeasons = () => jsonReader.ReadArrayAsync(default(Stream));
     await notFoundSeasons.Should().ThrowAsync <ArgumentNullException>();
 }
 public async Task Test_PostResponseNotFoundPersonArrayJsonReader_ReadArray_From_JsonReader_Null()
 {
     var traktJsonReader = new ArrayJsonReader <ITraktPostResponseNotFoundPerson>();
     Func <Task <IEnumerable <ITraktPostResponseNotFoundPerson> > > notFoundPersons = () => traktJsonReader.ReadArrayAsync(default(JsonTextReader));
     await notFoundPersons.Should().ThrowAsync <ArgumentNullException>();
 }
Exemplo n.º 7
0
 public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_JsonReader_Null()
 {
     var traktJsonReader = new ArrayJsonReader <ITraktWatchedShowEpisode>();
     Func <Task <IEnumerable <ITraktWatchedShowEpisode> > > traktEpisodeWatchedProgress = () => traktJsonReader.ReadArrayAsync(default(JsonTextReader));
     await traktEpisodeWatchedProgress.Should().ThrowAsync <ArgumentNullException>();
 }
Exemplo n.º 8
0
 public async Task Test_SeasonArrayJsonReader_ReadArray_From_Stream_Null()
 {
     var traktJsonReader = new ArrayJsonReader <ITraktSeason>();
     Func <Task <IEnumerable <ITraktSeason> > > traktSeasons = () => traktJsonReader.ReadArrayAsync(default(Stream));
     await traktSeasons.Should().ThrowAsync <ArgumentNullException>();
 }
Exemplo n.º 9
0
        public async Task Test_SeasonArrayJsonReader_ReadArray_From_Stream_Full_Complete()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktSeason>();

            using (var stream = FULL_JSON_COMPLETE.ToStream())
            {
                var traktSeasons = await traktJsonReader.ReadArrayAsync(stream);

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

                var seasons = traktSeasons.ToArray();

                seasons[0].Should().NotBeNull();
                seasons[0].Number.Should().Be(1);
                seasons[0].Ids.Should().NotBeNull();
                seasons[0].Ids.Trakt.Should().Be(61430U);
                seasons[0].Ids.Tvdb.Should().Be(279121U);
                seasons[0].Ids.Tmdb.Should().Be(60523U);
                seasons[0].Ids.TvRage.Should().Be(36939U);
                seasons[0].Rating.Should().Be(8.57053f);
                seasons[0].Votes.Should().Be(794);
                seasons[0].TotalEpisodesCount.Should().Be(10);
                seasons[0].AiredEpisodesCount.Should().Be(10);
                seasons[0].Overview.Should().Be("Trouble is brewing in the Seven Kingdoms of Westeros. For the driven inhabitants of this visionary world, control of Westeros' Iron Throne holds the lure of great power. But in a land where the seasons can last a lifetime, winter is coming...and beyond the Great Wall that protects them, an ancient evil has returned. In Season One, the story centers on three primary areas: the Stark and the Lannister families, whose designs on controlling the throne threaten a tenuous peace; the dragon princess Daenerys, heir to the former dynasty, who waits just over the Narrow Sea with her malevolent brother Viserys; and the Great Wall--a massive barrier of ice where a forgotten danger is stirring.");
                seasons[0].FirstAired.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime());
                seasons[0].Network.Should().Be("The CW");
                seasons[0].Episodes.Should().NotBeNull().And.HaveCount(2);

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

                episodes[0].Should().NotBeNull();
                episodes[0].SeasonNumber.Should().Be(1);
                episodes[0].Number.Should().Be(1);
                episodes[0].Title.Should().Be("Winter Is Coming");
                episodes[0].Ids.Should().NotBeNull();
                episodes[0].Ids.Trakt.Should().Be(73640U);
                episodes[0].Ids.Tvdb.Should().Be(3254641U);
                episodes[0].Ids.Imdb.Should().Be("tt1480055");
                episodes[0].Ids.Tmdb.Should().Be(63056U);
                episodes[0].Ids.TvRage.Should().Be(1065008299U);
                episodes[0].NumberAbsolute.Should().NotHaveValue();
                episodes[0].Overview.Should().BeNullOrEmpty();
                episodes[0].Runtime.Should().NotHaveValue();
                episodes[0].Rating.Should().NotHaveValue();
                episodes[0].Votes.Should().NotHaveValue();
                episodes[0].FirstAired.Should().NotHaveValue();
                episodes[0].UpdatedAt.Should().NotHaveValue();
                episodes[0].AvailableTranslationLanguageCodes.Should().BeNull();
                episodes[0].Translations.Should().BeNull();

                episodes[1].Should().NotBeNull();
                episodes[1].SeasonNumber.Should().Be(1);
                episodes[1].Number.Should().Be(2);
                episodes[1].Title.Should().Be("The Kingsroad");
                episodes[1].Ids.Should().NotBeNull();
                episodes[1].Ids.Trakt.Should().Be(74138U);
                episodes[1].Ids.Tvdb.Should().Be(3436411U);
                episodes[1].Ids.Imdb.Should().Be("tt1668746");
                episodes[1].Ids.Tmdb.Should().Be(63141U);
                episodes[1].Ids.TvRage.Should().Be(1325718577U);
                episodes[1].NumberAbsolute.Should().NotHaveValue();
                episodes[1].Overview.Should().BeNullOrEmpty();
                episodes[1].Runtime.Should().NotHaveValue();
                episodes[1].Rating.Should().NotHaveValue();
                episodes[1].Votes.Should().NotHaveValue();
                episodes[1].FirstAired.Should().NotHaveValue();
                episodes[1].UpdatedAt.Should().NotHaveValue();
                episodes[1].AvailableTranslationLanguageCodes.Should().BeNull();
                episodes[1].Translations.Should().BeNull();

                // ------------------------------------------------------------

                seasons[1].Should().NotBeNull();
                seasons[1].Number.Should().Be(2);
                seasons[1].Ids.Should().NotBeNull();
                seasons[1].Ids.Trakt.Should().Be(3964U);
                seasons[1].Ids.Tvdb.Should().Be(473271U);
                seasons[1].Ids.Tmdb.Should().Be(3625U);
                seasons[1].Ids.TvRage.Should().Be(36940U);
                seasons[1].Rating.Should().Be(9.10629f);
                seasons[1].Votes.Should().Be(1590);
                seasons[1].TotalEpisodesCount.Should().Be(10);
                seasons[1].AiredEpisodesCount.Should().Be(10);
                seasons[1].Overview.Should().Be("The cold winds of winter are rising in Westeros...war is coming...and five kings continue their savage quest for control of the all-powerful Iron Throne. With winter fast approaching, the coveted Iron Throne is occupied by the cruel Joffrey, counseled by his conniving mother Cersei and uncle Tyrion. But the Lannister hold on the Throne is under assault on many fronts. Meanwhile, a new leader is rising among the wildings outside the Great Wall, adding new perils for Jon Snow and the order of the Night's Watch.");
                seasons[1].FirstAired.Should().Be(DateTime.Parse("2012-04-02T01:00:00.000Z").ToUniversalTime());
                seasons[1].Network.Should().Be("The CW");
                seasons[1].Episodes.Should().NotBeNull().And.HaveCount(2);

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

                episodes[0].Should().NotBeNull();
                episodes[0].SeasonNumber.Should().Be(2);
                episodes[0].Number.Should().Be(1);
                episodes[0].Title.Should().Be("The North Remembers");
                episodes[0].Ids.Should().NotBeNull();
                episodes[0].Ids.Trakt.Should().Be(73650U);
                episodes[0].Ids.Tvdb.Should().Be(4161693U);
                episodes[0].Ids.Imdb.Should().Be("tt1971833");
                episodes[0].Ids.Tmdb.Should().Be(63066U);
                episodes[0].Ids.TvRage.Should().Be(1065074755U);
                episodes[0].NumberAbsolute.Should().NotHaveValue();
                episodes[0].Overview.Should().BeNullOrEmpty();
                episodes[0].Runtime.Should().NotHaveValue();
                episodes[0].Rating.Should().NotHaveValue();
                episodes[0].Votes.Should().NotHaveValue();
                episodes[0].FirstAired.Should().NotHaveValue();
                episodes[0].UpdatedAt.Should().NotHaveValue();
                episodes[0].AvailableTranslationLanguageCodes.Should().BeNull();
                episodes[0].Translations.Should().BeNull();

                episodes[1].Should().NotBeNull();
                episodes[1].SeasonNumber.Should().Be(2);
                episodes[1].Number.Should().Be(2);
                episodes[1].Title.Should().Be("The Night Lands");
                episodes[1].Ids.Should().NotBeNull();
                episodes[1].Ids.Trakt.Should().Be(73651U);
                episodes[1].Ids.Tvdb.Should().Be(4245771U);
                episodes[1].Ids.Imdb.Should().Be("tt2069318");
                episodes[1].Ids.Tmdb.Should().Be(974430U);
                episodes[1].Ids.TvRage.Should().Be(1065150289U);
                episodes[1].NumberAbsolute.Should().NotHaveValue();
                episodes[1].Overview.Should().BeNullOrEmpty();
                episodes[1].Runtime.Should().NotHaveValue();
                episodes[1].Rating.Should().NotHaveValue();
                episodes[1].Votes.Should().NotHaveValue();
                episodes[1].FirstAired.Should().NotHaveValue();
                episodes[1].UpdatedAt.Should().NotHaveValue();
                episodes[1].AvailableTranslationLanguageCodes.Should().BeNull();
                episodes[1].Translations.Should().BeNull();
            }
        }
        public override async Task <ITraktSyncRatingsPostShowSeason> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            CheckJsonTextReader(jsonReader);

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                var episodeArrayJsonReader = new ArrayJsonReader <ITraktSyncRatingsPostShowEpisode>();
                ITraktSyncRatingsPostShowSeason syncRatingsPostShow = new TraktSyncRatingsPostShowSeason();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.PROPERTY_NAME_RATED_AT:
                    {
                        Pair <bool, DateTime> value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            syncRatingsPostShow.RatedAt = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_RATING:
                        syncRatingsPostShow.Rating = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_NUMBER:
                    {
                        Pair <bool, int> value = await JsonReaderHelper.ReadIntegerValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            syncRatingsPostShow.Number = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_EPISODES:
                        syncRatingsPostShow.Episodes = await episodeArrayJsonReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(syncRatingsPostShow);
            }

            return(await Task.FromResult(default(ITraktSyncRatingsPostShowSeason)));
        }
Exemplo n.º 11
0
        public override async Task <ITraktShowCollectionProgress> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            CheckJsonTextReader(jsonReader);

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                var seasonsArrayReader = new ArrayJsonReader <ITraktSeason>();
                var seasonCollectionProgressArrayReader = new ArrayJsonReader <ITraktSeasonCollectionProgress>();
                var episodeObjectReader = new EpisodeObjectJsonReader();

                ITraktShowCollectionProgress traktShowCollectionProgress = new TraktShowCollectionProgress();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.PROPERTY_NAME_AIRED:
                        traktShowCollectionProgress.Aired = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_COMPLETED:
                        traktShowCollectionProgress.Completed = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_LAST_COLLECTED_AT:
                    {
                        var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            traktShowCollectionProgress.LastCollectedAt = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_SEASONS:
                        traktShowCollectionProgress.Seasons = await seasonCollectionProgressArrayReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_HIDDEN_SEASONS:
                        traktShowCollectionProgress.HiddenSeasons = await seasonsArrayReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_NEXT_EPISODE:
                        traktShowCollectionProgress.NextEpisode = await episodeObjectReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_LAST_EPISODE:
                        traktShowCollectionProgress.LastEpisode = await episodeObjectReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(traktShowCollectionProgress);
            }

            return(await Task.FromResult(default(ITraktShowCollectionProgress)));
        }
Exemplo n.º 12
0
 public async Task Test_UserCustomListsReorderPostArrayJsonReader_ReadArray_From_Json_String_Null()
 {
     var traktJsonReader = new ArrayJsonReader <ITraktUserCustomListsReorderPost>();
     Func <Task <IEnumerable <ITraktUserCustomListsReorderPost> > > traktUserCustomListsReorderPosts = () => traktJsonReader.ReadArrayAsync(default(string));
     await traktUserCustomListsReorderPosts.Should().ThrowAsync <ArgumentNullException>();
 }
Exemplo n.º 13
0
        public override async Task <ITraktSyncCollectionPostShow> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            CheckJsonTextReader(jsonReader);

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                ITraktSyncCollectionPostShow traktSyncCollectionPostShow = new TraktSyncCollectionPostShow();
                var showIdsObjectJsonReader = new ShowIdsObjectJsonReader();
                var syncCollectionPostShowSeasonArrayJsonReader = new ArrayJsonReader <ITraktSyncCollectionPostShowSeason>();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.PROPERTY_NAME_COLLECTED_AT:
                    {
                        Pair <bool, DateTime> value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            traktSyncCollectionPostShow.CollectedAt = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_TITLE:
                        traktSyncCollectionPostShow.Title = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_YEAR:
                        traktSyncCollectionPostShow.Year = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_IDS:
                        traktSyncCollectionPostShow.Ids = await showIdsObjectJsonReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_SEASONS:
                        traktSyncCollectionPostShow.Seasons = await syncCollectionPostShowSeasonArrayJsonReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_MEDIA_TYPE:
                        traktSyncCollectionPostShow.MediaType = await JsonReaderHelper.ReadEnumerationValueAsync <TraktMediaType>(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_RESOLUTION:
                        traktSyncCollectionPostShow.MediaResolution = await JsonReaderHelper.ReadEnumerationValueAsync <TraktMediaResolution>(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_AUDIO:
                        traktSyncCollectionPostShow.Audio = await JsonReaderHelper.ReadEnumerationValueAsync <TraktMediaAudio>(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_AUDIO_CHANNELS:
                        traktSyncCollectionPostShow.AudioChannels = await JsonReaderHelper.ReadEnumerationValueAsync <TraktMediaAudioChannel>(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_3D:
                        traktSyncCollectionPostShow.ThreeDimensional = await jsonReader.ReadAsBooleanAsync(cancellationToken);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(traktSyncCollectionPostShow);
            }

            return(await Task.FromResult(default(ITraktSyncCollectionPostShow)));
        }
        public async Task Test_SeasonCollectionProgressArrayJsonReader_ReadArray_From_Json_String_Incomplete_1()
        {
            var jsonReader = new ArrayJsonReader <ITraktSeasonCollectionProgress>();

            var traktSeasonCollectionProgresses = await jsonReader.ReadArrayAsync(JSON_INCOMPLETE_1);

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

            var collectionProgresses = traktSeasonCollectionProgresses.ToArray();

            collectionProgresses[0].Number.Should().BeNull();
            collectionProgresses[0].Aired.Should().Be(3);
            collectionProgresses[0].Completed.Should().Be(2);
            collectionProgresses[0].Episodes.Should().NotBeNull().And.HaveCount(2);

            var episodesCollectionProgress = collectionProgresses[0].Episodes.ToArray();

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

            episodesCollectionProgress[1].Should().NotBeNull();
            episodesCollectionProgress[1].Number.Should().Be(2);
            episodesCollectionProgress[1].Completed.Should().BeTrue();
            episodesCollectionProgress[1].CollectedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime());

            // -----------------------------------------------

            collectionProgresses[1].Number.Should().Be(2);
            collectionProgresses[1].Aired.Should().Be(3);
            collectionProgresses[1].Completed.Should().Be(2);
            collectionProgresses[1].Episodes.Should().NotBeNull().And.HaveCount(2);

            episodesCollectionProgress = collectionProgresses[1].Episodes.ToArray();

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

            episodesCollectionProgress[1].Should().NotBeNull();
            episodesCollectionProgress[1].Number.Should().Be(2);
            episodesCollectionProgress[1].Completed.Should().BeTrue();
            episodesCollectionProgress[1].CollectedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime());

            // -----------------------------------------------

            collectionProgresses[2].Number.Should().Be(3);
            collectionProgresses[2].Aired.Should().Be(3);
            collectionProgresses[2].Completed.Should().Be(2);
            collectionProgresses[2].Episodes.Should().NotBeNull().And.HaveCount(2);

            episodesCollectionProgress = collectionProgresses[2].Episodes.ToArray();

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

            episodesCollectionProgress[1].Should().NotBeNull();
            episodesCollectionProgress[1].Number.Should().Be(2);
            episodesCollectionProgress[1].Completed.Should().BeTrue();
            episodesCollectionProgress[1].CollectedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime());
        }
        public override async Task <ITraktShow> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            CheckJsonTextReader(jsonReader);

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                var idsObjectReader    = new ShowIdsObjectJsonReader();
                var airsObjectReader   = new ShowAirsObjectJsonReader();
                var seasonsArrayReader = new ArrayJsonReader <ITraktSeason>();

                ITraktShow traktShow = new TraktShow();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.PROPERTY_NAME_TITLE:
                        traktShow.Title = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_YEAR:
                        traktShow.Year = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_IDS:
                        traktShow.Ids = await idsObjectReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_OVERVIEW:
                        traktShow.Overview = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_FIRST_AIRED:
                    {
                        var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            traktShow.FirstAired = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_AIRS:
                        traktShow.Airs = await airsObjectReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_RUNTIME:
                        traktShow.Runtime = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_CERTIFICATION:
                        traktShow.Certification = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_NETWORK:
                        traktShow.Network = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_COUNTRY:
                        traktShow.CountryCode = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_TRAILER:
                        traktShow.Trailer = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_HOMEPAGE:
                        traktShow.Homepage = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_STATUS:
                        traktShow.Status = await JsonReaderHelper.ReadEnumerationValueAsync <TraktShowStatus>(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_RATING:
                        traktShow.Rating = (float?)await jsonReader.ReadAsDoubleAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_VOTES:
                        traktShow.Votes = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_UPDATED_AT:
                    {
                        var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            traktShow.UpdatedAt = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_LANGUAGE:
                        traktShow.LanguageCode = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_AVAILABLE_TRANSLATIONS:
                        traktShow.AvailableTranslationLanguageCodes = await JsonReaderHelper.ReadStringArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_GENRES:
                        traktShow.Genres = await JsonReaderHelper.ReadStringArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_AIRED_EPISODES:
                        traktShow.AiredEpisodes = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_SEASONS:
                        traktShow.Seasons = await seasonsArrayReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_COMMENT_COUNT:
                        traktShow.CommentCount = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(traktShow);
            }

            return(await Task.FromResult(default(ITraktShow)));
        }
        public async Task Test_SeasonWatchedProgressArrayJsonReader_ReadArray_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktSeasonWatchedProgress>();

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

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

                var watchedProgresses = traktSeasonWatchedProgresses.ToArray();

                watchedProgresses[0].Number.Should().Be(1);
                watchedProgresses[0].Aired.Should().Be(3);
                watchedProgresses[0].Completed.Should().Be(2);
                watchedProgresses[0].Episodes.Should().NotBeNull().And.HaveCount(2);

                var episodesWatchedProgress = watchedProgresses[0].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());

                // -----------------------------------------------

                watchedProgresses[1].Number.Should().Be(2);
                watchedProgresses[1].Aired.Should().Be(3);
                watchedProgresses[1].Completed.Should().Be(2);
                watchedProgresses[1].Episodes.Should().NotBeNull().And.HaveCount(2);

                episodesWatchedProgress = watchedProgresses[1].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());

                // -----------------------------------------------

                watchedProgresses[2].Number.Should().Be(3);
                watchedProgresses[2].Aired.Should().Be(3);
                watchedProgresses[2].Completed.Should().BeNull();
                watchedProgresses[2].Episodes.Should().NotBeNull().And.HaveCount(2);

                episodesWatchedProgress = watchedProgresses[2].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());
            }
        }
Exemplo n.º 17
0
 public async Task Test_CertificationsArrayJsonReader_ReadArray_From_Json_String_Null()
 {
     var jsonReader = new ArrayJsonReader <ITraktCertifications>();
     Func <Task <IEnumerable <ITraktCertifications> > > multipleTraktCertifications = () => jsonReader.ReadArrayAsync(default(string));
     await multipleTraktCertifications.Should().ThrowAsync <ArgumentNullException>();
 }
Exemplo n.º 18
0
        public override async Task <ITraktWatchedShow> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            CheckJsonTextReader(jsonReader);

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                var showObjectReader       = new ShowObjectJsonReader();
                var showSeasonsArrayReader = new ArrayJsonReader <ITraktWatchedShowSeason>();

                ITraktWatchedShow traktWatchedShow = new TraktWatchedShow();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.PROPERTY_NAME_PLAYS:
                        traktWatchedShow.Plays = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_LAST_WATCHED_AT:
                    {
                        var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            traktWatchedShow.LastWatchedAt = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_LAST_UPDATED_AT:
                    {
                        var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            traktWatchedShow.LastUpdatedAt = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_RESET_AT:
                    {
                        var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            traktWatchedShow.ResetAt = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_SHOW:
                        traktWatchedShow.Show = await showObjectReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_SEASONS:
                        traktWatchedShow.WatchedSeasons = await showSeasonsArrayReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(traktWatchedShow);
            }

            return(await Task.FromResult(default(ITraktWatchedShow)));
        }
Exemplo n.º 19
0
        public async Task Test_CrewArrayJsonReader_ReadArray_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktCrew>();

            using (var reader = new StringReader(JSON_NOT_VALID_3))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    IEnumerable <ITraktCrew> traktCrews = await traktJsonReader.ReadArrayAsync(jsonReader);

                    traktCrews.Should().NotBeNull();
                    ITraktCrew[] crews = traktCrews.ToArray();

                    crews[0].Production.Should().NotBeNull().And.HaveCount(1);
                    ITraktCrewMember[] productionCrew = crews[0].Production.ToArray();

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

                    crews[0].Art.Should().BeNull();
                    crews[0].Crew.Should().BeNull();
                    crews[0].CostumeAndMakeup.Should().BeNull();
                    crews[0].Directing.Should().BeNull();
                    crews[0].Writing.Should().BeNull();
                    crews[0].Sound.Should().BeNull();
                    crews[0].Camera.Should().BeNull();
                    crews[0].Lighting.Should().BeNull();
                    crews[0].VisualEffects.Should().BeNull();
                    crews[0].Editing.Should().BeNull();

                    crews[1].Production.Should().NotBeNull().And.HaveCount(1);
                    productionCrew = crews[1].Production.ToArray();

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

                    crews[1].Art.Should().BeNull();
                    crews[1].Crew.Should().BeNull();
                    crews[1].CostumeAndMakeup.Should().BeNull();
                    crews[1].Directing.Should().BeNull();
                    crews[1].Writing.Should().BeNull();
                    crews[1].Sound.Should().BeNull();
                    crews[1].Camera.Should().BeNull();
                    crews[1].Lighting.Should().BeNull();
                    crews[1].VisualEffects.Should().BeNull();
                    crews[1].Editing.Should().BeNull();
                }
        }
 public void Test_PersonShowCreditsCastItemArrayJsonReader_ReadObject_From_Stream_Null()
 {
     var traktJsonReader = new ArrayJsonReader<ITraktPersonShowCreditsCastItem>();
     Func<Task<IEnumerable<ITraktPersonShowCreditsCastItem>>> showCreditsCastItems = () => traktJsonReader.ReadArrayAsync(default(Stream));
     showCreditsCastItems.Should().Throw<ArgumentNullException>();
 }
Exemplo n.º 21
0
 public async Task Test_DeviceArrayJsonReader_ReadObject_From_Stream_Null()
 {
     var objectJsonReader = new ArrayJsonReader <ITraktDevice>();
     Func <Task <IEnumerable <ITraktDevice> > > traktDevices = () => objectJsonReader.ReadArrayAsync(default(Stream));
     await traktDevices.Should().ThrowAsync <ArgumentNullException>();
 }
 public async Task Test_CollectionShowSeasonArrayJsonReader_ReadArray_From_Stream_Null()
 {
     var jsonReader = new ArrayJsonReader <ITraktCollectionShowSeason>();
     Func <Task <IEnumerable <ITraktCollectionShowSeason> > > traktEpisodeCollectionProgress = () => jsonReader.ReadArrayAsync(default(Stream));
     await traktEpisodeCollectionProgress.Should().ThrowAsync <ArgumentNullException>();
 }
        public async Task Test_CommentItemArrayJsonReader_ReadArray_From_Json_String_Not_Valid_3()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktCommentItem>();
            IEnumerable <ITraktCommentItem> traktCommentItems = await traktJsonReader.ReadArrayAsync(JSON_NOT_VALID_3);

            traktCommentItems.Should().NotBeNull();
            ITraktCommentItem[] commentItems = traktCommentItems.ToArray();

            commentItems[0].Should().NotBeNull();
            commentItems[0].Type.Should().Be(TraktObjectType.Movie);

            commentItems[0].Movie.Should().BeNull();

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

            commentItems[0].Season.Should().NotBeNull();
            commentItems[0].Season.Number.Should().Be(1);
            commentItems[0].Season.Ids.Should().NotBeNull();
            commentItems[0].Season.Ids.Trakt.Should().Be(61430U);
            commentItems[0].Season.Ids.Tvdb.Should().Be(279121U);
            commentItems[0].Season.Ids.Tmdb.Should().Be(60523U);
            commentItems[0].Season.Ids.TvRage.Should().Be(36939U);

            commentItems[0].Episode.Should().NotBeNull();
            commentItems[0].Episode.SeasonNumber.Should().Be(1);
            commentItems[0].Episode.Number.Should().Be(1);
            commentItems[0].Episode.Title.Should().Be("Winter Is Coming");
            commentItems[0].Episode.Ids.Should().NotBeNull();
            commentItems[0].Episode.Ids.Trakt.Should().Be(73640U);
            commentItems[0].Episode.Ids.Tvdb.Should().Be(3254641U);
            commentItems[0].Episode.Ids.Imdb.Should().Be("tt1480055");
            commentItems[0].Episode.Ids.Tmdb.Should().Be(63056U);
            commentItems[0].Episode.Ids.TvRage.Should().Be(1065008299U);

            commentItems[0].List.Should().NotBeNull();
            commentItems[0].List.Name.Should().Be("Star Wars in machete order");
            commentItems[0].List.Description.Should().Be("Next time you want to introduce someone to Star Wars for the first time, watch the films with them in this order: IV, V, II, III, VI.");
            commentItems[0].List.Privacy.Should().Be(TraktAccessScope.Public);
            commentItems[0].List.DisplayNumbers.Should().BeTrue();
            commentItems[0].List.AllowComments.Should().BeFalse();
            commentItems[0].List.SortBy.Should().Be("rank");
            commentItems[0].List.SortHow.Should().Be("asc");
            commentItems[0].List.CreatedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
            commentItems[0].List.UpdatedAt.Should().Be(DateTime.Parse("2014-11-09T17:00:54.000Z").ToUniversalTime());
            commentItems[0].List.ItemCount.Should().Be(5);
            commentItems[0].List.CommentCount.Should().Be(1);
            commentItems[0].List.Likes.Should().Be(2);
            commentItems[0].List.Ids.Should().NotBeNull();
            commentItems[0].List.Ids.Trakt.Should().Be(55U);
            commentItems[0].List.Ids.Slug.Should().Be("star-wars-in-machete-order");
            commentItems[0].List.User.Should().NotBeNull();
            commentItems[0].List.User.Username.Should().Be("sean");
            commentItems[0].List.User.IsPrivate.Should().BeFalse();
            commentItems[0].List.User.Name.Should().Be("Sean Rudford");
            commentItems[0].List.User.IsVIP.Should().BeTrue();
            commentItems[0].List.User.IsVIP_EP.Should().BeFalse();
            commentItems[0].List.User.Ids.Should().NotBeNull();
            commentItems[0].List.User.Ids.Slug.Should().Be("sean");

            commentItems[1].Should().NotBeNull();
            commentItems[1].Type.Should().Be(TraktObjectType.Movie);

            commentItems[1].Movie.Should().BeNull();

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

            commentItems[1].Season.Should().NotBeNull();
            commentItems[1].Season.Number.Should().Be(1);
            commentItems[1].Season.Ids.Should().NotBeNull();
            commentItems[1].Season.Ids.Trakt.Should().Be(61430U);
            commentItems[1].Season.Ids.Tvdb.Should().Be(279121U);
            commentItems[1].Season.Ids.Tmdb.Should().Be(60523U);
            commentItems[1].Season.Ids.TvRage.Should().Be(36939U);

            commentItems[1].Episode.Should().NotBeNull();
            commentItems[1].Episode.SeasonNumber.Should().Be(1);
            commentItems[1].Episode.Number.Should().Be(1);
            commentItems[1].Episode.Title.Should().Be("Winter Is Coming");
            commentItems[1].Episode.Ids.Should().NotBeNull();
            commentItems[1].Episode.Ids.Trakt.Should().Be(73640U);
            commentItems[1].Episode.Ids.Tvdb.Should().Be(3254641U);
            commentItems[1].Episode.Ids.Imdb.Should().Be("tt1480055");
            commentItems[1].Episode.Ids.Tmdb.Should().Be(63056U);
            commentItems[1].Episode.Ids.TvRage.Should().Be(1065008299U);

            commentItems[1].List.Should().NotBeNull();
            commentItems[1].List.Name.Should().Be("Star Wars in machete order");
            commentItems[1].List.Description.Should().Be("Next time you want to introduce someone to Star Wars for the first time, watch the films with them in this order: IV, V, II, III, VI.");
            commentItems[1].List.Privacy.Should().Be(TraktAccessScope.Public);
            commentItems[1].List.DisplayNumbers.Should().BeTrue();
            commentItems[1].List.AllowComments.Should().BeFalse();
            commentItems[1].List.SortBy.Should().Be("rank");
            commentItems[1].List.SortHow.Should().Be("asc");
            commentItems[1].List.CreatedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
            commentItems[1].List.UpdatedAt.Should().Be(DateTime.Parse("2014-11-09T17:00:54.000Z").ToUniversalTime());
            commentItems[1].List.ItemCount.Should().Be(5);
            commentItems[1].List.CommentCount.Should().Be(1);
            commentItems[1].List.Likes.Should().Be(2);
            commentItems[1].List.Ids.Should().NotBeNull();
            commentItems[1].List.Ids.Trakt.Should().Be(55U);
            commentItems[1].List.Ids.Slug.Should().Be("star-wars-in-machete-order");
            commentItems[1].List.User.Should().NotBeNull();
            commentItems[1].List.User.Username.Should().Be("sean");
            commentItems[1].List.User.IsPrivate.Should().BeFalse();
            commentItems[1].List.User.Name.Should().Be("Sean Rudford");
            commentItems[1].List.User.IsVIP.Should().BeTrue();
            commentItems[1].List.User.IsVIP_EP.Should().BeFalse();
            commentItems[1].List.User.Ids.Should().NotBeNull();
            commentItems[1].List.User.Ids.Slug.Should().Be("sean");
        }
        public async Task Test_CollectionShowSeasonArrayJsonReader_ReadArray_From_Stream_Incomplete_1()
        {
            var jsonReader = new ArrayJsonReader <ITraktCollectionShowSeason>();

            using (var stream = JSON_INCOMPLETE_1.ToStream())
            {
                var traktCollectionShowSeasons = await jsonReader.ReadArrayAsync(stream);

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

                var collectionShowSeasons = traktCollectionShowSeasons.ToArray();

                collectionShowSeasons[0].Should().NotBeNull();
                collectionShowSeasons[0].Number.Should().BeNull();

                collectionShowSeasons[0].Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);
                var collectionShowSeasonEpisodes = collectionShowSeasons[0].Episodes.ToArray();

                collectionShowSeasonEpisodes[0].Number.Should().Be(1);
                collectionShowSeasonEpisodes[0].CollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime());
                collectionShowSeasonEpisodes[0].Metadata.Should().NotBeNull();
                collectionShowSeasonEpisodes[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
                collectionShowSeasonEpisodes[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                collectionShowSeasonEpisodes[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
                collectionShowSeasonEpisodes[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                collectionShowSeasonEpisodes[0].Metadata.ThreeDimensional.Should().BeTrue();

                collectionShowSeasonEpisodes[1].Number.Should().Be(2);
                collectionShowSeasonEpisodes[1].CollectedAt.Should().Be(DateTime.Parse("2014-07-15T01:00:00.000Z").ToUniversalTime());
                collectionShowSeasonEpisodes[1].Metadata.Should().NotBeNull();
                collectionShowSeasonEpisodes[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
                collectionShowSeasonEpisodes[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                collectionShowSeasonEpisodes[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
                collectionShowSeasonEpisodes[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                collectionShowSeasonEpisodes[1].Metadata.ThreeDimensional.Should().BeFalse();

                // -------------------------------------

                collectionShowSeasons[1].Should().NotBeNull();
                collectionShowSeasons[1].Number.Should().Be(2);

                collectionShowSeasons[1].Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);
                collectionShowSeasonEpisodes = collectionShowSeasons[1].Episodes.ToArray();

                collectionShowSeasonEpisodes[0].Number.Should().Be(1);
                collectionShowSeasonEpisodes[0].CollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime());
                collectionShowSeasonEpisodes[0].Metadata.Should().NotBeNull();
                collectionShowSeasonEpisodes[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
                collectionShowSeasonEpisodes[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                collectionShowSeasonEpisodes[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
                collectionShowSeasonEpisodes[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                collectionShowSeasonEpisodes[0].Metadata.ThreeDimensional.Should().BeTrue();

                collectionShowSeasonEpisodes[1].Number.Should().Be(2);
                collectionShowSeasonEpisodes[1].CollectedAt.Should().Be(DateTime.Parse("2014-07-15T01:00:00.000Z").ToUniversalTime());
                collectionShowSeasonEpisodes[1].Metadata.Should().NotBeNull();
                collectionShowSeasonEpisodes[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
                collectionShowSeasonEpisodes[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                collectionShowSeasonEpisodes[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
                collectionShowSeasonEpisodes[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                collectionShowSeasonEpisodes[1].Metadata.ThreeDimensional.Should().BeFalse();
            }
        }
 public async Task Test_PersonMovieCreditsCastItemArrayJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new ArrayJsonReader <ITraktPersonMovieCreditsCastItem>();
     Func <Task <IEnumerable <ITraktPersonMovieCreditsCastItem> > > movieCreditsCastItems = () => jsonReader.ReadArrayAsync(default(string));
     await movieCreditsCastItems.Should().ThrowAsync <ArgumentNullException>();
 }
        public async Task Test_EpisodeArrayJsonReader_ReadArray_From_JsonReader_Full_Complete()
        {
            var traktJsonReader = new ArrayJsonReader <ITraktEpisode>();

            using (var reader = new StringReader(FULL_JSON_COMPLETE))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktEpisodes = await traktJsonReader.ReadArrayAsync(jsonReader);

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

                    var episodes = traktEpisodes.ToArray();

                    episodes[0].Should().NotBeNull();
                    episodes[0].SeasonNumber.Should().Be(1);
                    episodes[0].Number.Should().Be(1);
                    episodes[0].Title.Should().Be("Winter Is Coming");
                    episodes[0].Ids.Should().NotBeNull();
                    episodes[0].Ids.Trakt.Should().Be(73640U);
                    episodes[0].Ids.Tvdb.Should().Be(3254641U);
                    episodes[0].Ids.Imdb.Should().Be("tt1480055");
                    episodes[0].Ids.Tmdb.Should().Be(63056U);
                    episodes[0].Ids.TvRage.Should().Be(1065008299U);
                    episodes[0].NumberAbsolute.Should().Be(1);
                    episodes[0].Overview.Should().Be("Ned Stark, Lord of Winterfell learns that his mentor, Jon Arryn, has died and that King Robert is on his way north to offer Ned Arryn’s position as the King’s Hand. Across the Narrow Sea in Pentos, Viserys Targaryen plans to wed his sister Daenerys to the nomadic Dothraki warrior leader, Khal Drogo to forge an alliance to take the throne.");
                    episodes[0].Runtime.Should().Be(55);
                    episodes[0].Rating.Should().Be(9.0f);
                    episodes[0].Votes.Should().Be(111);
                    episodes[0].FirstAired.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime());
                    episodes[0].UpdatedAt.Should().Be(DateTime.Parse("2014-08-29T23:16:39.000Z").ToUniversalTime());
                    episodes[0].AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(2).And.Contain("en", "es");
                    episodes[0].Translations.Should().NotBeNull().And.HaveCount(2);

                    var translations = episodes[0].Translations.ToArray();

                    translations[0].Should().NotBeNull();
                    translations[0].Title.Should().Be("Winter Is Coming");
                    translations[0].Overview.Should().Be("Jon Arryn, the Hand of the King, is dead. King Robert Baratheon plans to ask his oldest friend, Eddard Stark, to take Jon's place. Across the sea, Viserys Targaryen plans to wed his sister to a nomadic warlord in exchange for an army.");
                    translations[0].LanguageCode.Should().Be("en");

                    translations[1].Should().NotBeNull();
                    translations[1].Title.Should().Be("Se acerca el invierno");
                    translations[1].Overview.Should().Be("El Lord Ned Stark está preocupado por los perturbantes reportes de un desertor del Nights Watch; El Rey Robert y los Lannisters llegan a Winterfell; el exiliado Viserys Targaryen forja una nueva y poderosa alianza.");
                    translations[1].LanguageCode.Should().Be("es");

                    episodes[1].Should().NotBeNull();
                    episodes[1].SeasonNumber.Should().Be(1);
                    episodes[1].Number.Should().Be(2);
                    episodes[1].Title.Should().Be("The Kingsroad");
                    episodes[1].Ids.Should().NotBeNull();
                    episodes[1].Ids.Trakt.Should().Be(73641U);
                    episodes[1].Ids.Tvdb.Should().Be(3436411U);
                    episodes[1].Ids.Imdb.Should().Be("tt1668746");
                    episodes[1].Ids.Tmdb.Should().Be(63057U);
                    episodes[1].Ids.TvRage.Should().Be(1065023912U);
                    episodes[1].NumberAbsolute.Should().Be(2);
                    episodes[1].Overview.Should().Be("Having agreed to become the King’s Hand, Ned leaves Winterfell with daughters Sansa and Arya, while Catelyn stays behind in Winterfell. Jon Snow heads north to join the brotherhood of the Night’s Watch. Tyrion decides to forego the trip south with his family, instead joining Jon in the entourage heading to the Wall. Viserys bides his time in hopes of winning back the throne, while Daenerys focuses her attention on learning how to please her new husband, Drogo.");
                    episodes[1].Runtime.Should().Be(55);
                    episodes[1].Rating.Should().Be(8.22255f);
                    episodes[1].Votes.Should().Be(6183);
                    episodes[1].FirstAired.Should().Be(DateTime.Parse("2011-04-25T01:00:00.000Z").ToUniversalTime());
                    episodes[1].UpdatedAt.Should().Be(DateTime.Parse("2017-03-05T14:47:14.000Z").ToUniversalTime());
                    episodes[1].AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(2).And.Contain("en", "es");
                    episodes[1].Translations.Should().NotBeNull().And.HaveCount(2);

                    translations = episodes[1].Translations.ToArray();

                    translations[0].Should().NotBeNull();
                    translations[0].Title.Should().Be("The Kingsroad");
                    translations[0].Overview.Should().Be("While Bran recovers from his fall, Ned takes only his daughters to Kings Landing. Jon Snow goes with his uncle Benjen to The Wall. Tyrion joins them.");
                    translations[0].LanguageCode.Should().Be("en");

                    translations[1].Should().NotBeNull();
                    translations[1].Title.Should().Be("El Camino Real");
                    translations[1].Overview.Should().Be("Cuando Bran sobrevive milagrosamente a su caída de la torre, Cersei y Jaime conspiran para asegurar su silencio; Jon Snow y Tyrion se dirigen a El Muro; al convertirse en la mano derecha del rey, Ned deja Winterfell con sus hijas Sansa y Arya.");
                    translations[1].LanguageCode.Should().Be("es");
                }
        }
 public async Task Test_CountryArrayJsonReader_ReadArray_From_Stream_Null()
 {
     var jsonReader = new ArrayJsonReader <ITraktCountry>();
     Func <Task <IEnumerable <ITraktCountry> > > traktCountries = () => jsonReader.ReadArrayAsync(default(Stream));
     await traktCountries.Should().ThrowAsync <ArgumentNullException>();
 }
Exemplo n.º 28
0
        public override async Task <ITraktSeason> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            CheckJsonTextReader(jsonReader);

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                var          idsObjectReader     = new SeasonIdsObjectJsonReader();
                var          episodesArrayReader = new ArrayJsonReader <ITraktEpisode>();
                ITraktSeason traktSeason         = new TraktSeason();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.PROPERTY_NAME_NUMBER:
                        traktSeason.Number = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_TITLE:
                        traktSeason.Title = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_IDS:
                        traktSeason.Ids = await idsObjectReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_RATING:
                        traktSeason.Rating = (float?)await jsonReader.ReadAsDoubleAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_VOTES:
                        traktSeason.Votes = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_EPISODE_COUNT:
                        traktSeason.TotalEpisodesCount = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_AIRED_EPISODES:
                        traktSeason.AiredEpisodesCount = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_OVERVIEW:
                        traktSeason.Overview = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_FIRST_AIRED:
                    {
                        var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            traktSeason.FirstAired = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_UPDATED_AT:
                    {
                        var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            traktSeason.UpdatedAt = value.Second;
                        }

                        break;
                    }

                    case JsonProperties.PROPERTY_NAME_NETWORK:
                        traktSeason.Network = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_EPISODES:
                        traktSeason.Episodes = await episodesArrayReader.ReadArrayAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_COMMENT_COUNT:
                        traktSeason.CommentCount = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(traktSeason);
            }

            return(await Task.FromResult(default(ITraktSeason)));
        }
        public async Task Test_HistoryItemArrayJsonReader_Show_Read_Array_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktHistoryItem>();

            using (var stream = TYPE_SHOW_JSON_NOT_VALID_2.ToStream())
            {
                var traktHistoryItems = await jsonReader.ReadArrayAsync(stream);

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

                var historyItems = traktHistoryItems.ToArray();

                historyItems[0].Should().NotBeNull();
                historyItems[0].Id.Should().Be(1982348UL);
                historyItems[0].WatchedAt.Should().Be(DateTime.Parse("2013-06-15T05:54:27.000Z").ToUniversalTime());
                historyItems[0].Action.Should().Be(TraktHistoryActionType.Checkin);
                historyItems[0].Type.Should().Be(TraktSyncItemType.Show);
                historyItems[0].Show.Should().NotBeNull();
                historyItems[0].Show.Title.Should().Be("Game of Thrones");
                historyItems[0].Show.Year.Should().Be(2011);
                historyItems[0].Show.Airs.Should().BeNull();
                historyItems[0].Show.AvailableTranslationLanguageCodes.Should().BeNull();
                historyItems[0].Show.Ids.Should().NotBeNull();
                historyItems[0].Show.Ids.Trakt.Should().Be(1390U);
                historyItems[0].Show.Ids.Slug.Should().Be("game-of-thrones");
                historyItems[0].Show.Ids.Tvdb.Should().Be(121361U);
                historyItems[0].Show.Ids.Imdb.Should().Be("tt0944947");
                historyItems[0].Show.Ids.Tmdb.Should().Be(1399U);
                historyItems[0].Show.Ids.TvRage.Should().Be(24493U);
                historyItems[0].Show.Genres.Should().BeNull();
                historyItems[0].Show.Seasons.Should().BeNull();
                historyItems[0].Show.Overview.Should().BeNullOrEmpty();
                historyItems[0].Show.FirstAired.Should().NotHaveValue();
                historyItems[0].Show.Runtime.Should().NotHaveValue();
                historyItems[0].Show.Certification.Should().BeNullOrEmpty();
                historyItems[0].Show.Network.Should().BeNullOrEmpty();
                historyItems[0].Show.CountryCode.Should().BeNullOrEmpty();
                historyItems[0].Show.UpdatedAt.Should().NotHaveValue();
                historyItems[0].Show.Trailer.Should().BeNullOrEmpty();
                historyItems[0].Show.Homepage.Should().BeNullOrEmpty();
                historyItems[0].Show.Status.Should().BeNull();
                historyItems[0].Show.Rating.Should().NotHaveValue();
                historyItems[0].Show.Votes.Should().NotHaveValue();
                historyItems[0].Show.LanguageCode.Should().BeNullOrEmpty();
                historyItems[0].Show.AiredEpisodes.Should().NotHaveValue();
                historyItems[0].Movie.Should().BeNull();
                historyItems[0].Season.Should().BeNull();
                historyItems[0].Episode.Should().BeNull();

                historyItems[1].Should().NotBeNull();
                historyItems[1].Id.Should().Be(0);
                historyItems[1].WatchedAt.Should().Be(DateTime.Parse("2013-06-15T05:54:27.000Z").ToUniversalTime());
                historyItems[1].Action.Should().Be(TraktHistoryActionType.Checkin);
                historyItems[1].Type.Should().Be(TraktSyncItemType.Show);
                historyItems[1].Show.Should().NotBeNull();
                historyItems[1].Show.Title.Should().Be("Game of Thrones");
                historyItems[1].Show.Year.Should().Be(2011);
                historyItems[1].Show.Airs.Should().BeNull();
                historyItems[1].Show.AvailableTranslationLanguageCodes.Should().BeNull();
                historyItems[1].Show.Ids.Should().NotBeNull();
                historyItems[1].Show.Ids.Trakt.Should().Be(1390U);
                historyItems[1].Show.Ids.Slug.Should().Be("game-of-thrones");
                historyItems[1].Show.Ids.Tvdb.Should().Be(121361U);
                historyItems[1].Show.Ids.Imdb.Should().Be("tt0944947");
                historyItems[1].Show.Ids.Tmdb.Should().Be(1399U);
                historyItems[1].Show.Ids.TvRage.Should().Be(24493U);
                historyItems[1].Show.Genres.Should().BeNull();
                historyItems[1].Show.Seasons.Should().BeNull();
                historyItems[1].Show.Overview.Should().BeNullOrEmpty();
                historyItems[1].Show.FirstAired.Should().NotHaveValue();
                historyItems[1].Show.Runtime.Should().NotHaveValue();
                historyItems[1].Show.Certification.Should().BeNullOrEmpty();
                historyItems[1].Show.Network.Should().BeNullOrEmpty();
                historyItems[1].Show.CountryCode.Should().BeNullOrEmpty();
                historyItems[1].Show.UpdatedAt.Should().NotHaveValue();
                historyItems[1].Show.Trailer.Should().BeNullOrEmpty();
                historyItems[1].Show.Homepage.Should().BeNullOrEmpty();
                historyItems[1].Show.Status.Should().BeNull();
                historyItems[1].Show.Rating.Should().NotHaveValue();
                historyItems[1].Show.Votes.Should().NotHaveValue();
                historyItems[1].Show.LanguageCode.Should().BeNullOrEmpty();
                historyItems[1].Show.AiredEpisodes.Should().NotHaveValue();
                historyItems[1].Movie.Should().BeNull();
                historyItems[1].Season.Should().BeNull();
                historyItems[1].Episode.Should().BeNull();
            }
        }
 public async Task Test_WatchedShowSeasonArrayJsonReader_ReadArray_From_Json_String_Null()
 {
     var jsonReader = new ArrayJsonReader <ITraktWatchedShowSeason>();
     Func <Task <IEnumerable <ITraktWatchedShowSeason> > > traktSeasonWatchedProgress = () => jsonReader.ReadArrayAsync(default(string));
     await traktSeasonWatchedProgress.Should().ThrowAsync <ArgumentNullException>();
 }