public async Task Test_ListItemObjectJsonReader_Season_ReadObject_From_Stream_Not_Valid_1()
        {
            var jsonReader = new ListItemObjectJsonReader();

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

                traktListItem.Should().NotBeNull();
                traktListItem.Rank.Should().BeNull();
                traktListItem.ListedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
                traktListItem.Type.Should().Be(TraktListItemType.Season);
                traktListItem.Season.Should().NotBeNull();
                traktListItem.Season.Number.Should().Be(1);
                traktListItem.Season.Ids.Should().NotBeNull();
                traktListItem.Season.Ids.Trakt.Should().Be(61430U);
                traktListItem.Season.Ids.Tvdb.Should().Be(279121U);
                traktListItem.Season.Ids.Tmdb.Should().Be(60523U);
                traktListItem.Season.Ids.TvRage.Should().Be(36939U);

                traktListItem.Movie.Should().BeNull();
                traktListItem.Show.Should().BeNull();
                traktListItem.Episode.Should().BeNull();
                traktListItem.Person.Should().BeNull();
            }
        }
        public async Task Test_HistoryItemObjectJsonReader_Season_ReadObject_From_Stream_Not_Valid_1()
        {
            var jsonReader = new HistoryItemObjectJsonReader();

            using (var stream = TYPE_SEASON_JSON_NOT_VALID_1.ToStream())
            {
                var traktHistoryItem = await jsonReader.ReadObjectAsync(stream);

                traktHistoryItem.Should().NotBeNull();
                traktHistoryItem.Id.Should().Be(0UL);
                traktHistoryItem.WatchedAt.Should().Be(DateTime.Parse("2013-05-15T05:54:27.000Z").ToUniversalTime());
                traktHistoryItem.Action.Should().Be(TraktHistoryActionType.Watch);
                traktHistoryItem.Type.Should().Be(TraktSyncItemType.Season);
                traktHistoryItem.Season.Should().NotBeNull();
                traktHistoryItem.Season.Number.Should().Be(1);
                traktHistoryItem.Season.Ids.Should().NotBeNull();
                traktHistoryItem.Season.Ids.Trakt.Should().Be(61430U);
                traktHistoryItem.Season.Ids.Tvdb.Should().Be(279121U);
                traktHistoryItem.Season.Ids.Tmdb.Should().Be(60523U);
                traktHistoryItem.Season.Ids.TvRage.Should().Be(36939U);

                traktHistoryItem.Movie.Should().BeNull();
                traktHistoryItem.Show.Should().BeNull();
                traktHistoryItem.Episode.Should().BeNull();
            }
        }
        public async Task Test_RatingsItemObjectJsonReader_Season_ReadObject_From_Stream_Not_Valid_1()
        {
            var jsonReader = new RatingsItemObjectJsonReader();

            using (var stream = TYPE_SEASON_JSON_NOT_VALID_1.ToStream())
            {
                var traktRatingItem = await jsonReader.ReadObjectAsync(stream);

                traktRatingItem.Should().NotBeNull();
                traktRatingItem.RatedAt.Should().BeNull();
                traktRatingItem.Rating.Should().Be(8);
                traktRatingItem.Type.Should().Be(TraktRatingsItemType.Season);
                traktRatingItem.Season.Should().NotBeNull();
                traktRatingItem.Season.Number.Should().Be(1);
                traktRatingItem.Season.Ids.Should().NotBeNull();
                traktRatingItem.Season.Ids.Trakt.Should().Be(61430U);
                traktRatingItem.Season.Ids.Tvdb.Should().Be(279121U);
                traktRatingItem.Season.Ids.Tmdb.Should().Be(60523U);
                traktRatingItem.Season.Ids.TvRage.Should().Be(36939U);

                traktRatingItem.Movie.Should().BeNull();
                traktRatingItem.Show.Should().BeNull();
                traktRatingItem.Episode.Should().BeNull();
            }
        }
Ejemplo n.º 4
0
        public async Task Test_HistoryItemArrayJsonReader_Season_Read_Array_From_Stream_Not_Valid_1()
        {
            var jsonReader = new ArrayJsonReader <ITraktHistoryItem>();

            using (var stream = TYPE_SEASON_JSON_NOT_VALID_1.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-05-15T05:54:27.000Z").ToUniversalTime());
                historyItems[0].Action.Should().Be(TraktHistoryActionType.Watch);
                historyItems[0].Type.Should().Be(TraktSyncItemType.Season);
                historyItems[0].Season.Should().NotBeNull();
                historyItems[0].Season.Number.Should().Be(1);
                historyItems[0].Season.Ids.Should().NotBeNull();
                historyItems[0].Season.Ids.Trakt.Should().Be(61430U);
                historyItems[0].Season.Ids.Tvdb.Should().Be(279121U);
                historyItems[0].Season.Ids.Tmdb.Should().Be(60523U);
                historyItems[0].Season.Ids.TvRage.Should().Be(36939U);
                historyItems[0].Season.Rating.Should().NotHaveValue();
                historyItems[0].Season.Votes.Should().NotHaveValue();
                historyItems[0].Season.TotalEpisodesCount.Should().NotHaveValue();
                historyItems[0].Season.AiredEpisodesCount.Should().NotHaveValue();
                historyItems[0].Season.Overview.Should().BeNullOrEmpty();
                historyItems[0].Season.FirstAired.Should().NotHaveValue();
                historyItems[0].Season.Episodes.Should().BeNull();
                historyItems[0].Movie.Should().BeNull();
                historyItems[0].Show.Should().BeNull();
                historyItems[0].Episode.Should().BeNull();

                historyItems[1].Should().NotBeNull();
                historyItems[1].Id.Should().Be(1982344UL);
                historyItems[1].WatchedAt.Should().Be(DateTime.Parse("2013-05-15T05:54:27.000Z").ToUniversalTime());
                historyItems[1].Action.Should().Be(TraktHistoryActionType.Watch);
                historyItems[1].Type.Should().Be(TraktSyncItemType.Season);
                historyItems[1].Season.Should().NotBeNull();
                historyItems[1].Season.Number.Should().Be(1);
                historyItems[1].Season.Ids.Should().NotBeNull();
                historyItems[1].Season.Ids.Trakt.Should().Be(61430U);
                historyItems[1].Season.Ids.Tvdb.Should().Be(279121U);
                historyItems[1].Season.Ids.Tmdb.Should().Be(60523U);
                historyItems[1].Season.Ids.TvRage.Should().Be(36939U);
                historyItems[1].Season.Rating.Should().NotHaveValue();
                historyItems[1].Season.Votes.Should().NotHaveValue();
                historyItems[1].Season.TotalEpisodesCount.Should().NotHaveValue();
                historyItems[1].Season.AiredEpisodesCount.Should().NotHaveValue();
                historyItems[1].Season.Overview.Should().BeNullOrEmpty();
                historyItems[1].Season.FirstAired.Should().NotHaveValue();
                historyItems[1].Season.Episodes.Should().BeNull();
                historyItems[1].Movie.Should().BeNull();
                historyItems[1].Show.Should().BeNull();
                historyItems[1].Episode.Should().BeNull();
            }
        }
        public async Task Test_UserCommentObjectJsonReader_Season_ReadObject_From_Stream_Not_Valid_1()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            using (var stream = TYPE_SEASON_JSON_NOT_VALID_1.ToStream())
            {
                var traktUserComment = await jsonReader.ReadObjectAsync(stream);

                traktUserComment.Should().NotBeNull();
                traktUserComment.Type.Should().BeNull();
                traktUserComment.Comment.Should().NotBeNull();
                traktUserComment.Comment.Id.Should().Be(76957U);
                traktUserComment.Comment.ParentId.Should().Be(1234U);
                traktUserComment.Comment.CreatedAt.Should().Be(DateTime.Parse("2016-04-01T12:44:40Z").ToUniversalTime());
                traktUserComment.Comment.UpdatedAt.Should().Be(DateTime.Parse("2016-04-03T08:23:38Z").ToUniversalTime());
                traktUserComment.Comment.Comment.Should().Be("I hate they made The flash a kids show. Could else be much better. And with a better flash offcourse.");
                traktUserComment.Comment.Spoiler.Should().BeFalse();
                traktUserComment.Comment.Review.Should().BeFalse();
                traktUserComment.Comment.Replies.Should().Be(1);
                traktUserComment.Comment.Likes.Should().Be(2);
                traktUserComment.Comment.UserRating.Should().Be(7.3f);
                traktUserComment.Comment.User.Should().NotBeNull();
                traktUserComment.Comment.User.Username.Should().Be("sean");
                traktUserComment.Comment.User.IsPrivate.Should().BeFalse();
                traktUserComment.Comment.User.Name.Should().Be("Sean Rudford");
                traktUserComment.Comment.User.IsVIP.Should().BeTrue();
                traktUserComment.Comment.User.IsVIP_EP.Should().BeTrue();
                traktUserComment.Comment.User.Ids.Should().NotBeNull();
                traktUserComment.Comment.User.Ids.Slug.Should().Be("sean");
                traktUserComment.Season.Should().NotBeNull();
                traktUserComment.Season.Number.Should().Be(1);
                traktUserComment.Season.Title.Should().BeNullOrEmpty();
                traktUserComment.Season.Ids.Should().NotBeNull();
                traktUserComment.Season.Ids.Trakt.Should().Be(61430U);
                traktUserComment.Season.Ids.Tvdb.Should().Be(279121U);
                traktUserComment.Season.Ids.Tmdb.Should().Be(60523U);
                traktUserComment.Season.Ids.TvRage.Should().Be(36939U);

                traktUserComment.Movie.Should().BeNull();
                traktUserComment.Show.Should().BeNull();
                traktUserComment.Episode.Should().BeNull();
                traktUserComment.List.Should().BeNull();
            }
        }