Example #1
0
        public async Task Test_UserCommentObjectJsonReader_Episode_ReadObject_From_Stream_Complete()
        {
            var jsonReader = new UserCommentObjectJsonReader();

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

                traktUserComment.Should().NotBeNull();
                traktUserComment.Type.Should().Be(TraktObjectType.Episode);
                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.Episode.Should().NotBeNull();
                traktUserComment.Episode.SeasonNumber.Should().Be(1);
                traktUserComment.Episode.Number.Should().Be(1);
                traktUserComment.Episode.Title.Should().Be("Winter Is Coming");
                traktUserComment.Episode.Ids.Should().NotBeNull();
                traktUserComment.Episode.Ids.Trakt.Should().Be(73640U);
                traktUserComment.Episode.Ids.Tvdb.Should().Be(3254641U);
                traktUserComment.Episode.Ids.Imdb.Should().Be("tt1480055");
                traktUserComment.Episode.Ids.Tmdb.Should().Be(63056U);
                traktUserComment.Episode.Ids.TvRage.Should().Be(1065008299U);
                traktUserComment.Show.Should().NotBeNull();
                traktUserComment.Show.Title.Should().Be("Game of Thrones");
                traktUserComment.Show.Year.Should().Be(2011);
                traktUserComment.Show.Ids.Should().NotBeNull();
                traktUserComment.Show.Ids.Trakt.Should().Be(1390U);
                traktUserComment.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktUserComment.Show.Ids.Tvdb.Should().Be(121361U);
                traktUserComment.Show.Ids.Imdb.Should().Be("tt0944947");
                traktUserComment.Show.Ids.Tmdb.Should().Be(1399U);
                traktUserComment.Show.Ids.TvRage.Should().Be(24493U);

                traktUserComment.Movie.Should().BeNull();
                traktUserComment.Season.Should().BeNull();
                traktUserComment.List.Should().BeNull();
            }
        }
        public async Task Test_ListItemObjectJsonReader_Episode_ReadObject_From_Stream_Complete()
        {
            var jsonReader = new ListItemObjectJsonReader();

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

                traktListItem.Should().NotBeNull();
                traktListItem.Id.Should().Be(101U);
                traktListItem.Rank.Should().Be("1");
                traktListItem.ListedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
                traktListItem.Type.Should().Be(TraktListItemType.Episode);
                traktListItem.Episode.Should().NotBeNull();
                traktListItem.Episode.SeasonNumber.Should().Be(1);
                traktListItem.Episode.Number.Should().Be(1);
                traktListItem.Episode.Title.Should().Be("Winter Is Coming");
                traktListItem.Episode.Ids.Should().NotBeNull();
                traktListItem.Episode.Ids.Trakt.Should().Be(73640U);
                traktListItem.Episode.Ids.Tvdb.Should().Be(3254641U);
                traktListItem.Episode.Ids.Imdb.Should().Be("tt1480055");
                traktListItem.Episode.Ids.Tmdb.Should().Be(63056U);
                traktListItem.Episode.Ids.TvRage.Should().Be(1065008299U);
                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.Person.Should().BeNull();
            }
        }
        public async Task Test_SyncPlaybackProgressItemObjectJsonReader_Episode_ReadObject_From_Stream_Complete()
        {
            var jsonReader = new SyncPlaybackProgressItemObjectJsonReader();

            using (var stream = TYPE_EPISODE_JSON_COMPLETE.ToStream())
            {
                var traktPlaybackProgressItem = await jsonReader.ReadObjectAsync(stream);

                traktPlaybackProgressItem.Should().NotBeNull();
                traktPlaybackProgressItem.Id.Should().Be(37U);
                traktPlaybackProgressItem.Progress.Should().Be(65.5f);
                traktPlaybackProgressItem.PausedAt.Should().Be(DateTime.Parse("2015-01-25T22:01:32.000Z").ToUniversalTime());
                traktPlaybackProgressItem.Type.Should().Be(TraktSyncType.Episode);
                traktPlaybackProgressItem.Episode.Should().NotBeNull();
                traktPlaybackProgressItem.Episode.SeasonNumber.Should().Be(1);
                traktPlaybackProgressItem.Episode.Number.Should().Be(1);
                traktPlaybackProgressItem.Episode.Title.Should().Be("Winter Is Coming");
                traktPlaybackProgressItem.Episode.Ids.Should().NotBeNull();
                traktPlaybackProgressItem.Episode.Ids.Trakt.Should().Be(73640U);
                traktPlaybackProgressItem.Episode.Ids.Tvdb.Should().Be(3254641U);
                traktPlaybackProgressItem.Episode.Ids.Imdb.Should().Be("tt1480055");
                traktPlaybackProgressItem.Episode.Ids.Tmdb.Should().Be(63056U);
                traktPlaybackProgressItem.Episode.Ids.TvRage.Should().Be(1065008299U);

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

                traktPlaybackProgressItem.Movie.Should().BeNull();
            }
        }
Example #4
0
        public async Task Test_SearchResultObjectJsonReader_Episode_ReadObject_From_Stream_Complete()
        {
            var jsonReader = new SearchResultObjectJsonReader();

            using (var stream = TYPE_EPISODE_JSON_COMPLETE.ToStream())
            {
                var traktSearchResultItem = await jsonReader.ReadObjectAsync(stream);

                traktSearchResultItem.Should().NotBeNull();
                traktSearchResultItem.Type.Should().Be(TraktSearchResultType.Episode);
                traktSearchResultItem.Score.Should().Be(46.29501f);
                traktSearchResultItem.Episode.Should().NotBeNull();
                traktSearchResultItem.Episode.SeasonNumber.Should().Be(1);
                traktSearchResultItem.Episode.Number.Should().Be(1);
                traktSearchResultItem.Episode.Title.Should().Be("Winter Is Coming");
                traktSearchResultItem.Episode.Ids.Should().NotBeNull();
                traktSearchResultItem.Episode.Ids.Trakt.Should().Be(73640U);
                traktSearchResultItem.Episode.Ids.Tvdb.Should().Be(3254641U);
                traktSearchResultItem.Episode.Ids.Imdb.Should().Be("tt1480055");
                traktSearchResultItem.Episode.Ids.Tmdb.Should().Be(63056U);
                traktSearchResultItem.Episode.Ids.TvRage.Should().Be(1065008299U);
                traktSearchResultItem.Show.Should().NotBeNull();
                traktSearchResultItem.Show.Title.Should().Be("Game of Thrones");
                traktSearchResultItem.Show.Year.Should().Be(2011);
                traktSearchResultItem.Show.Ids.Should().NotBeNull();
                traktSearchResultItem.Show.Ids.Trakt.Should().Be(1390U);
                traktSearchResultItem.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktSearchResultItem.Show.Ids.Tvdb.Should().Be(121361U);
                traktSearchResultItem.Show.Ids.Imdb.Should().Be("tt0944947");
                traktSearchResultItem.Show.Ids.Tmdb.Should().Be(1399U);
                traktSearchResultItem.Show.Ids.TvRage.Should().Be(24493U);

                traktSearchResultItem.Movie.Should().BeNull();
                traktSearchResultItem.Person.Should().BeNull();
                traktSearchResultItem.List.Should().BeNull();
            }
        }
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_Stream_Complete()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            using (var stream = TYPE_EPISODE_JSON_COMPLETE.ToStream())
            {
                var traktUserWatchingItem = await jsonReader.ReadObjectAsync(stream);

                traktUserWatchingItem.Should().NotBeNull();
                traktUserWatchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
                traktUserWatchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
                traktUserWatchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
                traktUserWatchingItem.Type.Should().Be(TraktSyncType.Episode);
                traktUserWatchingItem.Episode.Should().NotBeNull();
                traktUserWatchingItem.Episode.SeasonNumber.Should().Be(1);
                traktUserWatchingItem.Episode.Number.Should().Be(1);
                traktUserWatchingItem.Episode.Title.Should().Be("Winter Is Coming");
                traktUserWatchingItem.Episode.Ids.Should().NotBeNull();
                traktUserWatchingItem.Episode.Ids.Trakt.Should().Be(73640U);
                traktUserWatchingItem.Episode.Ids.Tvdb.Should().Be(3254641U);
                traktUserWatchingItem.Episode.Ids.Imdb.Should().Be("tt1480055");
                traktUserWatchingItem.Episode.Ids.Tmdb.Should().Be(63056U);
                traktUserWatchingItem.Episode.Ids.TvRage.Should().Be(1065008299U);
                traktUserWatchingItem.Show.Should().NotBeNull();
                traktUserWatchingItem.Show.Title.Should().Be("Game of Thrones");
                traktUserWatchingItem.Show.Year.Should().Be(2011);
                traktUserWatchingItem.Show.Ids.Should().NotBeNull();
                traktUserWatchingItem.Show.Ids.Trakt.Should().Be(1390U);
                traktUserWatchingItem.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktUserWatchingItem.Show.Ids.Tvdb.Should().Be(121361U);
                traktUserWatchingItem.Show.Ids.Imdb.Should().Be("tt0944947");
                traktUserWatchingItem.Show.Ids.Tmdb.Should().Be(1399U);
                traktUserWatchingItem.Show.Ids.TvRage.Should().Be(24493U);

                traktUserWatchingItem.Movie.Should().BeNull();
            }
        }
        public async Task Test_SearchResultArrayJsonReader_Episode_ReadArray_From_Stream_Complete()
        {
            var jsonReader = new ArrayJsonReader <ITraktSearchResult>();

            using (var stream = TYPE_EPISODE_JSON_COMPLETE.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.Episode);
                searchResults[0].Score.Should().Be(46.29501f);
                searchResults[0].Episode.Should().NotBeNull();
                searchResults[0].Episode.SeasonNumber.Should().Be(1);
                searchResults[0].Episode.Number.Should().Be(1);
                searchResults[0].Episode.Title.Should().Be("Winter Is Coming");
                searchResults[0].Episode.Ids.Should().NotBeNull();
                searchResults[0].Episode.Ids.Trakt.Should().Be(73640U);
                searchResults[0].Episode.Ids.Tvdb.Should().Be(3254641U);
                searchResults[0].Episode.Ids.Imdb.Should().Be("tt1480055");
                searchResults[0].Episode.Ids.Tmdb.Should().Be(63056U);
                searchResults[0].Episode.Ids.TvRage.Should().Be(1065008299U);
                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].Person.Should().BeNull();
                searchResults[0].List.Should().BeNull();

                searchResults[1].Should().NotBeNull();
                searchResults[1].Type.Should().Be(TraktSearchResultType.Episode);
                searchResults[1].Score.Should().Be(46.29501f);
                searchResults[1].Episode.Should().NotBeNull();
                searchResults[1].Episode.SeasonNumber.Should().Be(1);
                searchResults[1].Episode.Number.Should().Be(1);
                searchResults[1].Episode.Title.Should().Be("Winter Is Coming");
                searchResults[1].Episode.Ids.Should().NotBeNull();
                searchResults[1].Episode.Ids.Trakt.Should().Be(73640U);
                searchResults[1].Episode.Ids.Tvdb.Should().Be(3254641U);
                searchResults[1].Episode.Ids.Imdb.Should().Be("tt1480055");
                searchResults[1].Episode.Ids.Tmdb.Should().Be(63056U);
                searchResults[1].Episode.Ids.TvRage.Should().Be(1065008299U);
                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].Person.Should().BeNull();
                searchResults[1].List.Should().BeNull();
            }
        }