public void Test_UserCommentObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new UserCommentObjectJsonReader();
            Func <Task <ITraktUserComment> > traktUserComment = () => jsonReader.ReadObjectAsync(default(string));

            traktUserComment.Should().Throw <ArgumentNullException>();
        }
示例#2
0
        public async Task Test_UserCommentObjectJsonReader_Movie_ReadObject_From_JsonReader_Incomplete_6()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(TYPE_MOVIE_JSON_INCOMPLETE_6))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserComment.Should().NotBeNull();
                    traktUserComment.Type.Should().BeNull();
                    traktUserComment.Comment.Should().BeNull();
                    traktUserComment.Movie.Should().NotBeNull();
                    traktUserComment.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                    traktUserComment.Movie.Year.Should().Be(2015);
                    traktUserComment.Movie.Ids.Should().NotBeNull();
                    traktUserComment.Movie.Ids.Trakt.Should().Be(94024U);
                    traktUserComment.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                    traktUserComment.Movie.Ids.Imdb.Should().Be("tt2488496");
                    traktUserComment.Movie.Ids.Tmdb.Should().Be(140607U);

                    traktUserComment.Show.Should().BeNull();
                    traktUserComment.Season.Should().BeNull();
                    traktUserComment.Episode.Should().BeNull();
                    traktUserComment.List.Should().BeNull();
                }
        }
        public async Task Test_UserCommentObjectJsonReader_List_ReadObject_From_Stream_Incomplete_1()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            using (var stream = TYPE_LIST_JSON_INCOMPLETE_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.List.Should().NotBeNull();
                traktUserComment.List.Name.Should().Be("Star Wars in machete order");
                traktUserComment.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.");
                traktUserComment.List.Privacy.Should().Be(TraktAccessScope.Public);
                traktUserComment.List.DisplayNumbers.Should().BeTrue();
                traktUserComment.List.AllowComments.Should().BeFalse();
                traktUserComment.List.SortBy.Should().Be("rank");
                traktUserComment.List.SortHow.Should().Be("asc");
                traktUserComment.List.CreatedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
                traktUserComment.List.UpdatedAt.Should().Be(DateTime.Parse("2014-11-09T17:00:54.000Z").ToUniversalTime());
                traktUserComment.List.ItemCount.Should().Be(5);
                traktUserComment.List.CommentCount.Should().Be(1);
                traktUserComment.List.Likes.Should().Be(2);
                traktUserComment.List.Ids.Should().NotBeNull();
                traktUserComment.List.Ids.Trakt.Should().Be(55);
                traktUserComment.List.Ids.Slug.Should().Be("star-wars-in-machete-order");
                traktUserComment.List.User.Should().NotBeNull();
                traktUserComment.List.User.Username.Should().Be("sean");
                traktUserComment.List.User.IsPrivate.Should().BeFalse();
                traktUserComment.List.User.Name.Should().Be("Sean Rudford");
                traktUserComment.List.User.IsVIP.Should().BeTrue();
                traktUserComment.List.User.IsVIP_EP.Should().BeFalse();
                traktUserComment.List.User.Ids.Should().NotBeNull();
                traktUserComment.List.User.Ids.Slug.Should().Be("sean");

                traktUserComment.Movie.Should().BeNull();
                traktUserComment.Show.Should().BeNull();
                traktUserComment.Season.Should().BeNull();
                traktUserComment.Episode.Should().BeNull();
            }
        }
        public async Task Test_UserCommentObjectJsonReader_Episode_ReadObject_From_Json_String_Incomplete_6()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await jsonReader.ReadObjectAsync(TYPE_EPISODE_JSON_INCOMPLETE_6);

            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.Episode.Should().BeNull();
            traktUserComment.Show.Should().BeNull();

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

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

                traktUserComment.Should().NotBeNull();
                traktUserComment.Type.Should().Be(TraktObjectType.Movie);
                traktUserComment.Comment.Should().BeNull();
                traktUserComment.Movie.Should().NotBeNull();
                traktUserComment.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                traktUserComment.Movie.Year.Should().Be(2015);
                traktUserComment.Movie.Ids.Should().NotBeNull();
                traktUserComment.Movie.Ids.Trakt.Should().Be(94024U);
                traktUserComment.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                traktUserComment.Movie.Ids.Imdb.Should().Be("tt2488496");
                traktUserComment.Movie.Ids.Tmdb.Should().Be(140607U);

                traktUserComment.Show.Should().BeNull();
                traktUserComment.Season.Should().BeNull();
                traktUserComment.Episode.Should().BeNull();
                traktUserComment.List.Should().BeNull();
            }
        }
        public async Task Test_UserCommentObjectJsonReader_Episode_ReadObject_From_Json_String_Incomplete_7()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await jsonReader.ReadObjectAsync(TYPE_EPISODE_JSON_INCOMPLETE_7);

            traktUserComment.Should().NotBeNull();
            traktUserComment.Type.Should().BeNull();
            traktUserComment.Comment.Should().BeNull();
            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().BeNull();

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

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

                traktUserComment.Should().NotBeNull();
                traktUserComment.Type.Should().Be(TraktObjectType.Season);
                traktUserComment.Comment.Should().BeNull();
                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();
            }
        }
        public async Task Test_UserCommentObjectJsonReader_Season_ReadObject_From_JsonReader_Incomplete_6()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(TYPE_SEASON_JSON_INCOMPLETE_6))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserComment.Should().NotBeNull();
                    traktUserComment.Type.Should().BeNull();
                    traktUserComment.Comment.Should().BeNull();
                    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();
                }
        }
示例#9
0
        public async Task Test_UserCommentObjectJsonReader_Show_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await jsonReader.ReadObjectAsync(TYPE_SHOW_JSON_NOT_VALID_2);

            traktUserComment.Should().NotBeNull();
            traktUserComment.Type.Should().Be(TraktObjectType.Show);
            traktUserComment.Comment.Should().BeNull();
            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.Episode.Should().BeNull();
            traktUserComment.List.Should().BeNull();
        }
        public async Task Test_UserCommentObjectJsonReader_Episode_ReadObject_From_Json_String_Incomplete_8()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await jsonReader.ReadObjectAsync(TYPE_EPISODE_JSON_INCOMPLETE_8);

            traktUserComment.Should().NotBeNull();
            traktUserComment.Type.Should().BeNull();
            traktUserComment.Comment.Should().BeNull();
            traktUserComment.Episode.Should().BeNull();
            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_UserCommentObjectJsonReader_Episode_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await jsonReader.ReadObjectAsync(TYPE_EPISODE_JSON_NOT_VALID_2);

            traktUserComment.Should().NotBeNull();
            traktUserComment.Type.Should().Be(TraktObjectType.Episode);
            traktUserComment.Comment.Should().BeNull();
            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_UserCommentObjectJsonReader_Show_ReadObject_From_Stream_Incomplete_6()
        {
            var jsonReader = new UserCommentObjectJsonReader();

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

                traktUserComment.Should().NotBeNull();
                traktUserComment.Type.Should().BeNull();
                traktUserComment.Comment.Should().BeNull();
                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.Episode.Should().BeNull();
                traktUserComment.List.Should().BeNull();
            }
        }
        public async Task Test_UserCommentObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await jsonReader.ReadObjectAsync(string.Empty);

            traktUserComment.Should().BeNull();
        }
示例#14
0
        public async Task Test_UserCommentObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktUserComment.Should().BeNull();
        }
示例#15
0
        public async Task Test_UserCommentObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await jsonReader.ReadObjectAsync(default(Stream));

            traktUserComment.Should().BeNull();
        }
        public async Task Test_UserCommentObjectJsonReader_Episode_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(TYPE_EPISODE_JSON_INCOMPLETE_1))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    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.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_UserCommentObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new UserCommentObjectJsonReader();

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

                traktUserComment.Should().BeNull();
            }
        }
示例#18
0
        public async Task Test_UserCommentObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(string.Empty))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserComment.Should().BeNull();
                }
        }
        public async Task Test_UserCommentObjectJsonReader_Episode_ReadObject_From_Json_String_Not_Valid_5()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await jsonReader.ReadObjectAsync(TYPE_EPISODE_JSON_NOT_VALID_5);

            traktUserComment.Should().NotBeNull();
            traktUserComment.Type.Should().BeNull();
            traktUserComment.Comment.Should().BeNull();
            traktUserComment.Episode.Should().BeNull();
            traktUserComment.Show.Should().BeNull();
            traktUserComment.Movie.Should().BeNull();
            traktUserComment.Season.Should().BeNull();
            traktUserComment.List.Should().BeNull();
        }
        public async Task Test_UserCommentObjectJsonReader_Episode_ReadObject_From_Json_String_Incomplete_5()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            var traktUserComment = await jsonReader.ReadObjectAsync(TYPE_EPISODE_JSON_INCOMPLETE_5);

            traktUserComment.Should().NotBeNull();
            traktUserComment.Type.Should().Be(TraktObjectType.Episode);
            traktUserComment.Comment.Should().BeNull();
            traktUserComment.Episode.Should().BeNull();
            traktUserComment.Show.Should().BeNull();

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

            using (var stream = TYPE_SHOW_JSON_INCOMPLETE_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.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.Episode.Should().BeNull();
                traktUserComment.List.Should().BeNull();
            }
        }
示例#22
0
        public async Task Test_UserCommentObjectJsonReader_Episode_ReadObject_From_Stream_Not_Valid_4()
        {
            var jsonReader = new UserCommentObjectJsonReader();

            using (var stream = TYPE_EPISODE_JSON_NOT_VALID_4.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().BeNull();

                traktUserComment.Movie.Should().BeNull();
                traktUserComment.Season.Should().BeNull();
                traktUserComment.List.Should().BeNull();
            }
        }
        public async Task Test_UserCommentObjectJsonReader_Season_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(TYPE_SEASON_JSON_INCOMPLETE_1))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    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();
                }
        }
示例#24
0
        public async Task Test_UserCommentObjectJsonReader_Movie_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(TYPE_MOVIE_JSON_INCOMPLETE_1))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    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.Movie.Should().NotBeNull();
                    traktUserComment.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                    traktUserComment.Movie.Year.Should().Be(2015);
                    traktUserComment.Movie.Ids.Should().NotBeNull();
                    traktUserComment.Movie.Ids.Trakt.Should().Be(94024U);
                    traktUserComment.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                    traktUserComment.Movie.Ids.Imdb.Should().Be("tt2488496");
                    traktUserComment.Movie.Ids.Tmdb.Should().Be(140607U);

                    traktUserComment.Show.Should().BeNull();
                    traktUserComment.Season.Should().BeNull();
                    traktUserComment.Episode.Should().BeNull();
                    traktUserComment.List.Should().BeNull();
                }
        }
        public async Task Test_UserCommentObjectJsonReader_Season_ReadObject_From_Stream_Not_Valid_4()
        {
            var jsonReader = new UserCommentObjectJsonReader();

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

                traktUserComment.Should().NotBeNull();
                traktUserComment.Type.Should().BeNull();
                traktUserComment.Comment.Should().BeNull();
                traktUserComment.Season.Should().BeNull();
                traktUserComment.Movie.Should().BeNull();
                traktUserComment.Show.Should().BeNull();
                traktUserComment.Episode.Should().BeNull();
                traktUserComment.List.Should().BeNull();
            }
        }
示例#26
0
        public async Task Test_UserCommentObjectJsonReader_List_ReadObject_From_JsonReader_Not_Valid_2()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(TYPE_LIST_JSON_NOT_VALID_2))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserComment.Should().NotBeNull();
                    traktUserComment.Type.Should().Be(TraktObjectType.List);
                    traktUserComment.Comment.Should().BeNull();
                    traktUserComment.List.Should().NotBeNull();
                    traktUserComment.List.Name.Should().Be("Star Wars in machete order");
                    traktUserComment.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.");
                    traktUserComment.List.Privacy.Should().Be(TraktAccessScope.Public);
                    traktUserComment.List.DisplayNumbers.Should().BeTrue();
                    traktUserComment.List.AllowComments.Should().BeFalse();
                    traktUserComment.List.SortBy.Should().Be("rank");
                    traktUserComment.List.SortHow.Should().Be("asc");
                    traktUserComment.List.CreatedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
                    traktUserComment.List.UpdatedAt.Should().Be(DateTime.Parse("2014-11-09T17:00:54.000Z").ToUniversalTime());
                    traktUserComment.List.ItemCount.Should().Be(5);
                    traktUserComment.List.CommentCount.Should().Be(1);
                    traktUserComment.List.Likes.Should().Be(2);
                    traktUserComment.List.Ids.Should().NotBeNull();
                    traktUserComment.List.Ids.Trakt.Should().Be(55);
                    traktUserComment.List.Ids.Slug.Should().Be("star-wars-in-machete-order");
                    traktUserComment.List.User.Should().NotBeNull();
                    traktUserComment.List.User.Username.Should().Be("sean");
                    traktUserComment.List.User.IsPrivate.Should().BeFalse();
                    traktUserComment.List.User.Name.Should().Be("Sean Rudford");
                    traktUserComment.List.User.IsVIP.Should().BeTrue();
                    traktUserComment.List.User.IsVIP_EP.Should().BeFalse();
                    traktUserComment.List.User.Ids.Should().NotBeNull();
                    traktUserComment.List.User.Ids.Slug.Should().Be("sean");

                    traktUserComment.Movie.Should().BeNull();
                    traktUserComment.Show.Should().BeNull();
                    traktUserComment.Season.Should().BeNull();
                    traktUserComment.Episode.Should().BeNull();
                }
        }
        public async Task Test_UserCommentObjectJsonReader_Season_ReadObject_From_Stream_Incomplete_4()
        {
            var jsonReader = new UserCommentObjectJsonReader();

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

                traktUserComment.Should().NotBeNull();
                traktUserComment.Type.Should().Be(TraktObjectType.Season);
                traktUserComment.Comment.Should().BeNull();
                traktUserComment.Season.Should().BeNull();

                traktUserComment.Movie.Should().BeNull();
                traktUserComment.Show.Should().BeNull();
                traktUserComment.Episode.Should().BeNull();
                traktUserComment.List.Should().BeNull();
            }
        }
示例#28
0
        public async Task Test_UserCommentObjectJsonReader_Movie_ReadObject_From_JsonReader_Not_Valid_4()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(TYPE_MOVIE_JSON_NOT_VALID_4))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserComment.Should().NotBeNull();
                    traktUserComment.Type.Should().BeNull();
                    traktUserComment.Comment.Should().BeNull();
                    traktUserComment.Movie.Should().BeNull();
                    traktUserComment.Show.Should().BeNull();
                    traktUserComment.Season.Should().BeNull();
                    traktUserComment.Episode.Should().BeNull();
                    traktUserComment.List.Should().BeNull();
                }
        }
示例#29
0
        public async Task Test_UserCommentObjectJsonReader_Movie_ReadObject_From_JsonReader_Incomplete_4()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(TYPE_MOVIE_JSON_INCOMPLETE_4))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserComment.Should().NotBeNull();
                    traktUserComment.Type.Should().Be(TraktObjectType.Movie);
                    traktUserComment.Comment.Should().BeNull();
                    traktUserComment.Movie.Should().BeNull();

                    traktUserComment.Show.Should().BeNull();
                    traktUserComment.Season.Should().BeNull();
                    traktUserComment.Episode.Should().BeNull();
                    traktUserComment.List.Should().BeNull();
                }
        }
示例#30
0
        public async Task Test_UserCommentObjectJsonReader_Movie_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new UserCommentObjectJsonReader();

            using (var reader = new StringReader(TYPE_MOVIE_JSON_NOT_VALID_3))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserComment = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserComment.Should().NotBeNull();
                    traktUserComment.Type.Should().Be(TraktObjectType.Movie);
                    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.Movie.Should().BeNull();

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