示例#1
0
        public void Test_CommentLikeObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();
            Func <Task <ITraktCommentLike> > traktCommentLike = () => traktJsonReader.ReadObjectAsync(default(string));

            traktCommentLike.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();
            ITraktCommentLike traktCommentLike = await traktJsonReader.ReadObjectAsync(string.Empty);

            traktCommentLike.Should().BeNull();
        }
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();
            ITraktCommentLike traktCommentLike = await traktJsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktCommentLike.Should().NotBeNull();
            traktCommentLike.LikedAt.Should().BeNull();
            traktCommentLike.User.Should().BeNull();
        }
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();
            ITraktCommentLike traktCommentLike = await traktJsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            traktCommentLike.Should().NotBeNull();
            traktCommentLike.LikedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
            traktCommentLike.User.Should().BeNull();
        }
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new CommentLikeObjectJsonReader();

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

                traktCommentLike.Should().BeNull();
            }
        }
示例#6
0
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();

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

                    traktCommentLike.Should().BeNull();
                }
        }
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new CommentLikeObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                ITraktCommentLike traktCommentLike = await jsonReader.ReadObjectAsync(stream);

                traktCommentLike.Should().NotBeNull();
                traktCommentLike.LikedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
                traktCommentLike.User.Should().BeNull();
            }
        }
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new CommentLikeObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                ITraktCommentLike traktCommentLike = await jsonReader.ReadObjectAsync(stream);

                traktCommentLike.Should().NotBeNull();
                traktCommentLike.LikedAt.Should().BeNull();
                traktCommentLike.User.Should().BeNull();
            }
        }
示例#9
0
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();

            using (var reader = new StringReader(JSON_INCOMPLETE_2))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    ITraktCommentLike traktCommentLike = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktCommentLike.Should().NotBeNull();
                    traktCommentLike.LikedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
                    traktCommentLike.User.Should().BeNull();
                }
        }
示例#10
0
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();

            using (var reader = new StringReader(JSON_NOT_VALID_3))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    ITraktCommentLike traktCommentLike = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktCommentLike.Should().NotBeNull();
                    traktCommentLike.LikedAt.Should().BeNull();
                    traktCommentLike.User.Should().BeNull();
                }
        }
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();
            ITraktCommentLike traktCommentLike = await traktJsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

            traktCommentLike.Should().NotBeNull();
            traktCommentLike.LikedAt.Should().BeNull();
            traktCommentLike.User.Should().NotBeNull();
            traktCommentLike.User.Username.Should().Be("sean");
            traktCommentLike.User.IsPrivate.Should().BeFalse();
            traktCommentLike.User.Name.Should().Be("Sean Rudford");
            traktCommentLike.User.IsVIP.Should().BeTrue();
            traktCommentLike.User.IsVIP_EP.Should().BeFalse();
            traktCommentLike.User.Ids.Should().NotBeNull();
            traktCommentLike.User.Ids.Slug.Should().Be("sean");
        }
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_Json_String_Complete()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();
            ITraktCommentLike traktCommentLike = await traktJsonReader.ReadObjectAsync(JSON_COMPLETE);

            traktCommentLike.Should().NotBeNull();
            traktCommentLike.LikedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime());
            traktCommentLike.User.Should().NotBeNull();
            traktCommentLike.User.Username.Should().Be("sean");
            traktCommentLike.User.IsPrivate.Should().BeFalse();
            traktCommentLike.User.Name.Should().Be("Sean Rudford");
            traktCommentLike.User.IsVIP.Should().BeTrue();
            traktCommentLike.User.IsVIP_EP.Should().BeFalse();
            traktCommentLike.User.Ids.Should().NotBeNull();
            traktCommentLike.User.Ids.Slug.Should().Be("sean");
        }
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_Stream_Not_Valid_1()
        {
            var jsonReader = new CommentLikeObjectJsonReader();

            using (var stream = JSON_NOT_VALID_1.ToStream())
            {
                ITraktCommentLike traktCommentLike = await jsonReader.ReadObjectAsync(stream);

                traktCommentLike.Should().NotBeNull();
                traktCommentLike.LikedAt.Should().BeNull();
                traktCommentLike.User.Should().NotBeNull();
                traktCommentLike.User.Username.Should().Be("sean");
                traktCommentLike.User.IsPrivate.Should().BeFalse();
                traktCommentLike.User.Name.Should().Be("Sean Rudford");
                traktCommentLike.User.IsVIP.Should().BeTrue();
                traktCommentLike.User.IsVIP_EP.Should().BeFalse();
                traktCommentLike.User.Ids.Should().NotBeNull();
                traktCommentLike.User.Ids.Slug.Should().Be("sean");
            }
        }
示例#14
0
        public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new CommentLikeObjectJsonReader();

            using (var reader = new StringReader(JSON_INCOMPLETE_1))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    ITraktCommentLike traktCommentLike = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktCommentLike.Should().NotBeNull();
                    traktCommentLike.LikedAt.Should().BeNull();
                    traktCommentLike.User.Should().NotBeNull();
                    traktCommentLike.User.Username.Should().Be("sean");
                    traktCommentLike.User.IsPrivate.Should().BeFalse();
                    traktCommentLike.User.Name.Should().Be("Sean Rudford");
                    traktCommentLike.User.IsVIP.Should().BeTrue();
                    traktCommentLike.User.IsVIP_EP.Should().BeFalse();
                    traktCommentLike.User.Ids.Should().NotBeNull();
                    traktCommentLike.User.Ids.Slug.Should().Be("sean");
                }
        }
示例#15
0
 public async Task Test_CommentLikeObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new CommentLikeObjectJsonReader();
     Func <Task <ITraktCommentLike> > traktCommentLike = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktCommentLike.Should().ThrowAsync <ArgumentNullException>();
 }