예제 #1
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_1()
        {
            var traktJsonReader = new UserFollowRequestObjectJsonReader();

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

                    userFollowRequest.Should().NotBeNull();
                    userFollowRequest.Id.Should().Be(0U);
                    userFollowRequest.RequestedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());

                    userFollowRequest.User.Should().NotBeNull();
                    userFollowRequest.User.Username.Should().Be("sean");
                    userFollowRequest.User.IsPrivate.Should().BeFalse();
                    userFollowRequest.User.Name.Should().Be("Sean Rudford");
                    userFollowRequest.User.IsVIP.Should().BeTrue();
                    userFollowRequest.User.IsVIP_EP.Should().BeTrue();
                    userFollowRequest.User.Ids.Should().NotBeNull();
                    userFollowRequest.User.Ids.Slug.Should().Be("sean");
                    userFollowRequest.User.JoinedAt.Should().HaveValue().And.Be(DateTime.Parse("2010-09-25T17:49:25.000Z").ToUniversalTime());
                    userFollowRequest.User.Location.Should().Be("SF");
                    userFollowRequest.User.About.Should().Be("I have all your cassette tapes.");
                    userFollowRequest.User.Gender.Should().Be("male");
                    userFollowRequest.User.Age.Should().Be(35);
                    userFollowRequest.User.Images.Should().NotBeNull();
                    userFollowRequest.User.Images.Avatar.Should().NotBeNull();
                    userFollowRequest.User.Images.Avatar.Full.Should().Be("https://walter-dev.trakt.tv/images/users/000/000/001/avatars/large/0ba3f72910.jpg");
                }
        }
예제 #2
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_2.ToStream())
            {
                var userFollowRequest = await jsonReader.ReadObjectAsync(stream);

                userFollowRequest.Should().NotBeNull();
                userFollowRequest.Id.Should().Be(12345U);
                userFollowRequest.RequestedAt.Should().BeNull();

                userFollowRequest.User.Should().NotBeNull();
                userFollowRequest.User.Username.Should().Be("sean");
                userFollowRequest.User.IsPrivate.Should().BeFalse();
                userFollowRequest.User.Name.Should().Be("Sean Rudford");
                userFollowRequest.User.IsVIP.Should().BeTrue();
                userFollowRequest.User.IsVIP_EP.Should().BeTrue();
                userFollowRequest.User.Ids.Should().NotBeNull();
                userFollowRequest.User.Ids.Slug.Should().Be("sean");
                userFollowRequest.User.JoinedAt.Should().HaveValue().And.Be(DateTime.Parse("2010-09-25T17:49:25.000Z").ToUniversalTime());
                userFollowRequest.User.Location.Should().Be("SF");
                userFollowRequest.User.About.Should().Be("I have all your cassette tapes.");
                userFollowRequest.User.Gender.Should().Be("male");
                userFollowRequest.User.Age.Should().Be(35);
                userFollowRequest.User.Images.Should().NotBeNull();
                userFollowRequest.User.Images.Avatar.Should().NotBeNull();
                userFollowRequest.User.Images.Avatar.Full.Should().Be("https://walter-dev.trakt.tv/images/users/000/000/001/avatars/large/0ba3f72910.jpg");
            }
        }
        public void Test_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();
            Func <Task <ITraktUserFollowRequest> > userFollowRequest = () => jsonReader.ReadObjectAsync(default(Stream));

            userFollowRequest.Should().Throw <ArgumentNullException>();
        }
예제 #4
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

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

            userFollowRequest.Should().BeNull();
        }
예제 #5
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

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

            userFollowRequest.Should().BeNull();
        }
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new UserFollowRequestObjectJsonReader();

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

            userFollowRequest.Should().BeNull();
        }
예제 #7
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Json_String_Not_Valid_4()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

            var userFollowRequest = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_4);

            userFollowRequest.Should().NotBeNull();
            userFollowRequest.Id.Should().Be(0U);
            userFollowRequest.RequestedAt.Should().BeNull();
            userFollowRequest.User.Should().BeNull();
        }
예제 #8
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Json_String_Incomplete_5()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

            var userFollowRequest = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_5);

            userFollowRequest.Should().NotBeNull();
            userFollowRequest.Id.Should().Be(0U);
            userFollowRequest.RequestedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
            userFollowRequest.User.Should().BeNull();
        }
예제 #9
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

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

                userFollowRequest.Should().BeNull();
            }
        }
예제 #10
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Json_String_Incomplete_4()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

            var userFollowRequest = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_4);

            userFollowRequest.Should().NotBeNull();
            userFollowRequest.Id.Should().Be(12345U);
            userFollowRequest.RequestedAt.Should().BeNull();
            userFollowRequest.User.Should().BeNull();
        }
예제 #11
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new UserFollowRequestObjectJsonReader();

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

                    userFollowRequest.Should().BeNull();
                }
        }
예제 #12
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

            var userFollowRequest = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            userFollowRequest.Should().NotBeNull();
            userFollowRequest.Id.Should().Be(12345U);
            userFollowRequest.RequestedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());

            userFollowRequest.User.Should().BeNull();
        }
예제 #13
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Not_Valid_4()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

            using (var stream = JSON_NOT_VALID_4.ToStream())
            {
                var userFollowRequest = await jsonReader.ReadObjectAsync(stream);

                userFollowRequest.Should().NotBeNull();
                userFollowRequest.Id.Should().Be(0U);
                userFollowRequest.RequestedAt.Should().BeNull();
                userFollowRequest.User.Should().BeNull();
            }
        }
예제 #14
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Incomplete_4()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_4.ToStream())
            {
                var userFollowRequest = await jsonReader.ReadObjectAsync(stream);

                userFollowRequest.Should().NotBeNull();
                userFollowRequest.Id.Should().Be(12345U);
                userFollowRequest.RequestedAt.Should().BeNull();
                userFollowRequest.User.Should().BeNull();
            }
        }
예제 #15
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Incomplete_3()
        {
            var jsonReader = new UserFollowRequestObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_3.ToStream())
            {
                var userFollowRequest = await jsonReader.ReadObjectAsync(stream);

                userFollowRequest.Should().NotBeNull();
                userFollowRequest.Id.Should().Be(12345U);
                userFollowRequest.RequestedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
                userFollowRequest.User.Should().BeNull();
            }
        }
예제 #16
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_4()
        {
            var traktJsonReader = new UserFollowRequestObjectJsonReader();

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

                    userFollowRequest.Should().NotBeNull();
                    userFollowRequest.Id.Should().Be(0U);
                    userFollowRequest.RequestedAt.Should().BeNull();
                    userFollowRequest.User.Should().BeNull();
                }
        }
예제 #17
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_JsonReader_Incomplete_3()
        {
            var traktJsonReader = new UserFollowRequestObjectJsonReader();

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

                    userFollowRequest.Should().NotBeNull();
                    userFollowRequest.Id.Should().Be(12345U);
                    userFollowRequest.RequestedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());
                    userFollowRequest.User.Should().BeNull();
                }
        }
예제 #18
0
        public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_JsonReader_Incomplete_4()
        {
            var traktJsonReader = new UserFollowRequestObjectJsonReader();

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

                    userFollowRequest.Should().NotBeNull();
                    userFollowRequest.Id.Should().Be(12345U);
                    userFollowRequest.RequestedAt.Should().BeNull();
                    userFollowRequest.User.Should().BeNull();
                }
        }
예제 #19
0
 public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new UserFollowRequestObjectJsonReader();
     Func <Task <ITraktUserFollowRequest> > userFollowRequest = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await userFollowRequest.Should().ThrowAsync <ArgumentNullException>();
 }