Exemplo n.º 1
0
        public void Test_UserLikeItemObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();
            Func <Task <ITraktUserLikeItem> > traktUserLikeItem = () => jsonReader.ReadObjectAsync(default(string));

            traktUserLikeItem.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_UserLikeItemObjectJsonReader_Comment_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

            var traktUserLikeItem = await jsonReader.ReadObjectAsync(TYPE_COMMENT_JSON_NOT_VALID_1);

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

            traktUserLikeItem.List.Should().BeNull();
        }
        public async Task Test_TraktUserLikeItem_With_Type_Episode_From_Json()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();
            var likeItem   = await jsonReader.ReadObjectAsync(TYPE_LIST_JSON) as TraktUserLikeItem;

            likeItem.Should().NotBeNull();
            likeItem.LikedAt.Should().Be(DateTime.Parse("2015-03-30T23:18:42.000Z").ToUniversalTime());
            likeItem.Type.Should().Be(TraktUserLikeType.List);
            likeItem.List.Should().NotBeNull();
            likeItem.List.Name.Should().Be("Star Wars in machete order");
            likeItem.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.");
            likeItem.List.Privacy.Should().Be(TraktAccessScope.Public);
            likeItem.List.DisplayNumbers.Should().BeTrue();
            likeItem.List.AllowComments.Should().BeFalse();
            likeItem.List.SortBy.Should().Be("rank");
            likeItem.List.SortHow.Should().Be("asc");
            likeItem.List.CreatedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
            likeItem.List.UpdatedAt.Should().Be(DateTime.Parse("2014-11-09T17:00:54.000Z").ToUniversalTime());
            likeItem.List.ItemCount.Should().Be(5);
            likeItem.List.CommentCount.Should().Be(1);
            likeItem.List.Likes.Should().Be(2);
            likeItem.List.Ids.Should().NotBeNull();
            likeItem.List.Ids.Trakt.Should().Be(55);
            likeItem.List.Ids.Slug.Should().Be("star-wars-in-machete-order");
            likeItem.List.User.Should().NotBeNull();
            likeItem.List.User.Username.Should().Be("sean");
            likeItem.List.User.IsPrivate.Should().BeFalse();
            likeItem.List.User.Name.Should().Be("Sean Rudford");
            likeItem.List.User.IsVIP.Should().BeTrue();
            likeItem.List.User.IsVIP_EP.Should().BeFalse();
            likeItem.List.User.Ids.Should().NotBeNull();
            likeItem.List.User.Ids.Slug.Should().Be("sean");
            likeItem.Comment.Should().BeNull();
        }
Exemplo n.º 4
0
        public async Task Test_UserLikeItemObjectJsonReader_Comment_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

            using (var stream = TYPE_COMMENT_JSON_INCOMPLETE_2.ToStream())
            {
                var traktUserLikeItem = await jsonReader.ReadObjectAsync(stream);

                traktUserLikeItem.Should().NotBeNull();
                traktUserLikeItem.LikedAt.Should().Be(DateTime.Parse("2015-03-30T23:18:42.000Z").ToUniversalTime());
                traktUserLikeItem.Type.Should().BeNull();
                traktUserLikeItem.Comment.Should().NotBeNull();
                traktUserLikeItem.Comment.Id.Should().Be(76957U);
                traktUserLikeItem.Comment.ParentId.Should().Be(1234U);
                traktUserLikeItem.Comment.CreatedAt.Should().Be(DateTime.Parse("2016-04-01T12:44:40Z").ToUniversalTime());
                traktUserLikeItem.Comment.UpdatedAt.Should().Be(DateTime.Parse("2016-04-03T08:23:38Z").ToUniversalTime());
                traktUserLikeItem.Comment.Comment.Should().Be("I hate they made The flash a kids show. Could else be much better. And with a better flash offcourse.");
                traktUserLikeItem.Comment.Spoiler.Should().BeFalse();
                traktUserLikeItem.Comment.Review.Should().BeFalse();
                traktUserLikeItem.Comment.Replies.Should().Be(1);
                traktUserLikeItem.Comment.Likes.Should().Be(2);
                traktUserLikeItem.Comment.UserRating.Should().Be(7.3f);
                traktUserLikeItem.Comment.User.Should().NotBeNull();
                traktUserLikeItem.Comment.User.Username.Should().Be("sean");
                traktUserLikeItem.Comment.User.IsPrivate.Should().BeFalse();
                traktUserLikeItem.Comment.User.Name.Should().Be("Sean Rudford");
                traktUserLikeItem.Comment.User.IsVIP.Should().BeTrue();
                traktUserLikeItem.Comment.User.IsVIP_EP.Should().BeTrue();
                traktUserLikeItem.Comment.User.Ids.Should().NotBeNull();
                traktUserLikeItem.Comment.User.Ids.Slug.Should().Be("sean");

                traktUserLikeItem.List.Should().BeNull();
            }
        }
        public async Task Test_UserLikeItemObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

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

            traktUserLikeItem.Should().BeNull();
        }
        public async Task Test_UserLikeItemObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new UserLikeItemObjectJsonReader();

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

            traktUserLikeItem.Should().BeNull();
        }
        public async Task Test_UserLikeItemObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

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

            traktUserLikeItem.Should().BeNull();
        }
        public async Task Test_UserLikeItemObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

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

                traktUserLikeItem.Should().BeNull();
            }
        }
Exemplo n.º 9
0
        public async Task Test_UserLikeItemObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new UserLikeItemObjectJsonReader();

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

                    traktUserLikeItem.Should().BeNull();
                }
        }
        public async Task Test_UserLikeItemObjectJsonReader_Comment_ReadObject_From_Json_String_Not_Valid_4()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

            var traktUserLikeItem = await jsonReader.ReadObjectAsync(TYPE_COMMENT_JSON_NOT_VALID_4);

            traktUserLikeItem.Should().NotBeNull();
            traktUserLikeItem.LikedAt.Should().BeNull();
            traktUserLikeItem.Type.Should().BeNull();
            traktUserLikeItem.Comment.Should().BeNull();
            traktUserLikeItem.List.Should().BeNull();
        }
        public async Task Test_UserLikeItemObjectJsonReader_Comment_ReadObject_From_Json_String_Incomplete_4()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

            var traktUserLikeItem = await jsonReader.ReadObjectAsync(TYPE_COMMENT_JSON_INCOMPLETE_4);

            traktUserLikeItem.Should().NotBeNull();
            traktUserLikeItem.LikedAt.Should().Be(DateTime.Parse("2015-03-30T23:18:42.000Z").ToUniversalTime());
            traktUserLikeItem.Type.Should().BeNull();
            traktUserLikeItem.Comment.Should().BeNull();

            traktUserLikeItem.List.Should().BeNull();
        }
        public async Task Test_UserLikeItemObjectJsonReader_Comment_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

            var traktUserLikeItem = await jsonReader.ReadObjectAsync(TYPE_COMMENT_JSON_NOT_VALID_3);

            traktUserLikeItem.Should().NotBeNull();
            traktUserLikeItem.LikedAt.Should().Be(DateTime.Parse("2015-03-30T23:18:42.000Z").ToUniversalTime());
            traktUserLikeItem.Type.Should().Be(TraktUserLikeType.Comment);
            traktUserLikeItem.Comment.Should().BeNull();

            traktUserLikeItem.List.Should().BeNull();
        }
        public async Task Test_UserLikeItemObjectJsonReader_Comment_ReadObject_From_Json_String_Incomplete_5()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

            var traktUserLikeItem = await jsonReader.ReadObjectAsync(TYPE_COMMENT_JSON_INCOMPLETE_5);

            traktUserLikeItem.Should().NotBeNull();
            traktUserLikeItem.LikedAt.Should().BeNull();
            traktUserLikeItem.Type.Should().Be(TraktUserLikeType.Comment);
            traktUserLikeItem.Comment.Should().BeNull();

            traktUserLikeItem.List.Should().BeNull();
        }
Exemplo n.º 14
0
        public async Task Test_UserLikeItemObjectJsonReader_List_ReadObject_From_Stream_Not_Valid_4()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

            using (var stream = TYPE_LIST_JSON_NOT_VALID_4.ToStream())
            {
                var traktUserLikeItem = await jsonReader.ReadObjectAsync(stream);

                traktUserLikeItem.Should().NotBeNull();
                traktUserLikeItem.LikedAt.Should().BeNull();
                traktUserLikeItem.Type.Should().BeNull();
                traktUserLikeItem.List.Should().BeNull();
                traktUserLikeItem.Comment.Should().BeNull();
            }
        }
Exemplo n.º 15
0
        public async Task Test_UserLikeItemObjectJsonReader_List_ReadObject_From_JsonReader_Not_Valid_4()
        {
            var traktJsonReader = new UserLikeItemObjectJsonReader();

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

                    traktUserLikeItem.Should().NotBeNull();
                    traktUserLikeItem.LikedAt.Should().BeNull();
                    traktUserLikeItem.Type.Should().BeNull();
                    traktUserLikeItem.List.Should().BeNull();
                    traktUserLikeItem.Comment.Should().BeNull();
                }
        }
Exemplo n.º 16
0
        public async Task Test_UserLikeItemObjectJsonReader_List_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

            using (var stream = TYPE_LIST_JSON_NOT_VALID_3.ToStream())
            {
                var traktUserLikeItem = await jsonReader.ReadObjectAsync(stream);

                traktUserLikeItem.Should().NotBeNull();
                traktUserLikeItem.LikedAt.Should().Be(DateTime.Parse("2015-03-30T23:18:42.000Z").ToUniversalTime());
                traktUserLikeItem.Type.Should().Be(TraktUserLikeType.List);
                traktUserLikeItem.List.Should().BeNull();

                traktUserLikeItem.Comment.Should().BeNull();
            }
        }
Exemplo n.º 17
0
        public async Task Test_UserLikeItemObjectJsonReader_List_ReadObject_From_Stream_Incomplete_5()
        {
            var jsonReader = new UserLikeItemObjectJsonReader();

            using (var stream = TYPE_LIST_JSON_INCOMPLETE_5.ToStream())
            {
                var traktUserLikeItem = await jsonReader.ReadObjectAsync(stream);

                traktUserLikeItem.Should().NotBeNull();
                traktUserLikeItem.LikedAt.Should().BeNull();
                traktUserLikeItem.Type.Should().Be(TraktUserLikeType.List);
                traktUserLikeItem.List.Should().BeNull();

                traktUserLikeItem.Comment.Should().BeNull();
            }
        }
Exemplo n.º 18
0
        public async Task Test_UserLikeItemObjectJsonReader_List_ReadObject_From_JsonReader_Incomplete_5()
        {
            var traktJsonReader = new UserLikeItemObjectJsonReader();

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

                    traktUserLikeItem.Should().NotBeNull();
                    traktUserLikeItem.LikedAt.Should().BeNull();
                    traktUserLikeItem.Type.Should().Be(TraktUserLikeType.List);
                    traktUserLikeItem.List.Should().BeNull();

                    traktUserLikeItem.Comment.Should().BeNull();
                }
        }
Exemplo n.º 19
0
        public async Task Test_UserLikeItemObjectJsonReader_List_ReadObject_From_JsonReader_Incomplete_4()
        {
            var traktJsonReader = new UserLikeItemObjectJsonReader();

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

                    traktUserLikeItem.Should().NotBeNull();
                    traktUserLikeItem.LikedAt.Should().Be(DateTime.Parse("2015-03-30T23:18:42.000Z").ToUniversalTime());
                    traktUserLikeItem.Type.Should().BeNull();
                    traktUserLikeItem.List.Should().BeNull();

                    traktUserLikeItem.Comment.Should().BeNull();
                }
        }
Exemplo n.º 20
0
        public async Task Test_UserLikeItemObjectJsonReader_List_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new UserLikeItemObjectJsonReader();

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

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

                    traktUserLikeItem.Comment.Should().BeNull();
                }
        }
Exemplo n.º 21
0
 public async Task Test_UserLikeItemObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new UserLikeItemObjectJsonReader();
     Func <Task <ITraktUserLikeItem> > traktUserLikeItem = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktUserLikeItem.Should().ThrowAsync <ArgumentNullException>();
 }