public async Task Test_UserHiddenItemObjectJsonReader_Show_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new UserHiddenItemObjectJsonReader();

            using (var stream = TYPE_SHOW_JSON_INCOMPLETE_2.ToStream())
            {
                var traktUserHiddenItem = await jsonReader.ReadObjectAsync(stream);

                traktUserHiddenItem.Should().NotBeNull();
                traktUserHiddenItem.HiddenAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
                traktUserHiddenItem.Type.Should().BeNull();
                traktUserHiddenItem.Show.Should().NotBeNull();
                traktUserHiddenItem.Show.Title.Should().Be("Game of Thrones");
                traktUserHiddenItem.Show.Year.Should().Be(2011);
                traktUserHiddenItem.Show.Ids.Should().NotBeNull();
                traktUserHiddenItem.Show.Ids.Trakt.Should().Be(1390U);
                traktUserHiddenItem.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktUserHiddenItem.Show.Ids.Tvdb.Should().Be(121361U);
                traktUserHiddenItem.Show.Ids.Imdb.Should().Be("tt0944947");
                traktUserHiddenItem.Show.Ids.Tmdb.Should().Be(1399U);
                traktUserHiddenItem.Show.Ids.TvRage.Should().Be(24493U);

                traktUserHiddenItem.Movie.Should().BeNull();
                traktUserHiddenItem.Season.Should().BeNull();
            }
        }
        public async Task Test_ListItemObjectJsonReader_Show_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new ListItemObjectJsonReader();

            using (var stream = TYPE_SHOW_JSON_INCOMPLETE_2.ToStream())
            {
                var traktListItem = await jsonReader.ReadObjectAsync(stream);

                traktListItem.Should().NotBeNull();
                traktListItem.Rank.Should().Be("1");
                traktListItem.ListedAt.Should().BeNull();
                traktListItem.Type.Should().Be(TraktListItemType.Show);
                traktListItem.Show.Should().NotBeNull();
                traktListItem.Show.Title.Should().Be("Game of Thrones");
                traktListItem.Show.Year.Should().Be(2011);
                traktListItem.Show.Ids.Should().NotBeNull();
                traktListItem.Show.Ids.Trakt.Should().Be(1390U);
                traktListItem.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktListItem.Show.Ids.Tvdb.Should().Be(121361U);
                traktListItem.Show.Ids.Imdb.Should().Be("tt0944947");
                traktListItem.Show.Ids.Tmdb.Should().Be(1399U);
                traktListItem.Show.Ids.TvRage.Should().Be(24493U);

                traktListItem.Movie.Should().BeNull();
                traktListItem.Season.Should().BeNull();
                traktListItem.Episode.Should().BeNull();
                traktListItem.Person.Should().BeNull();
            }
        }
Пример #3
0
        public async Task Test_SearchResultArrayJsonReader_Show_ReadArray_From_Stream_Incomplete_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktSearchResult>();

            using (var stream = TYPE_SHOW_JSON_INCOMPLETE_2.ToStream())
            {
                IEnumerable <ITraktSearchResult> traktSearchResults = await jsonReader.ReadArrayAsync(stream);

                traktSearchResults.Should().NotBeNull();
                ITraktSearchResult[] searchResults = traktSearchResults.ToArray();

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

                searchResults[0].Movie.Should().BeNull();
                searchResults[0].Episode.Should().BeNull();
                searchResults[0].Person.Should().BeNull();
                searchResults[0].List.Should().BeNull();

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

                searchResults[1].Movie.Should().BeNull();
                searchResults[1].Episode.Should().BeNull();
                searchResults[1].Person.Should().BeNull();
                searchResults[1].List.Should().BeNull();
            }
        }
        public async Task Test_HistoryItemArrayJsonReader_Show_Read_Array_From_Stream_Incomplete_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktHistoryItem>();

            using (var stream = TYPE_SHOW_JSON_INCOMPLETE_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(0);
                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(1982348UL);
                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();
            }
        }