Esempio n. 1
0
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new UserFollowUserPostResponseObjectJsonReader();

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

                    userFollowUserPostResponse.Should().NotBeNull();

                    userFollowUserPostResponse.ApprovedAt.Should().BeNull();

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

            userFollowUserPostResponse.Should().NotBeNull();

            userFollowUserPostResponse.ApprovedAt.Should().Be(DateTime.Parse("2014-11-15T09:41:34.704Z").ToUniversalTime());

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

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

            userFollowUserPostResponse.Should().BeNull();
        }
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new UserFollowUserPostResponseObjectJsonReader();

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

            userFollowUserPostResponse.Should().BeNull();
        }
Esempio n. 5
0
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new UserFollowUserPostResponseObjectJsonReader();

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

            userFollowUserPostResponse.Should().BeNull();
        }
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new UserFollowUserPostResponseObjectJsonReader();

            var userFollowUserPostResponse = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            userFollowUserPostResponse.Should().NotBeNull();

            userFollowUserPostResponse.ApprovedAt.Should().BeNull();
            userFollowUserPostResponse.User.Should().BeNull();
        }
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new UserFollowUserPostResponseObjectJsonReader();

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

                userFollowUserPostResponse.Should().BeNull();
            }
        }
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new UserFollowUserPostResponseObjectJsonReader();

            var userFollowUserPostResponse = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            userFollowUserPostResponse.Should().NotBeNull();

            userFollowUserPostResponse.ApprovedAt.Should().Be(DateTime.Parse("2014-11-15T09:41:34.704Z").ToUniversalTime());

            userFollowUserPostResponse.User.Should().BeNull();
        }
Esempio n. 9
0
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new UserFollowUserPostResponseObjectJsonReader();

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

                    userFollowUserPostResponse.Should().BeNull();
                }
        }
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new UserFollowUserPostResponseObjectJsonReader();

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

                userFollowUserPostResponse.Should().NotBeNull();

                userFollowUserPostResponse.ApprovedAt.Should().BeNull();
                userFollowUserPostResponse.User.Should().BeNull();
            }
        }
Esempio n. 11
0
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new UserFollowUserPostResponseObjectJsonReader();

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

                    userFollowUserPostResponse.Should().NotBeNull();

                    userFollowUserPostResponse.ApprovedAt.Should().BeNull();
                    userFollowUserPostResponse.User.Should().BeNull();
                }
        }
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new UserFollowUserPostResponseObjectJsonReader();

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

                userFollowUserPostResponse.Should().NotBeNull();

                userFollowUserPostResponse.ApprovedAt.Should().Be(DateTime.Parse("2014-11-15T09:41:34.704Z").ToUniversalTime());

                userFollowUserPostResponse.User.Should().BeNull();
            }
        }
Esempio n. 13
0
        public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_2()
        {
            var traktJsonReader = new UserFollowUserPostResponseObjectJsonReader();

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

                    userFollowUserPostResponse.Should().NotBeNull();

                    userFollowUserPostResponse.ApprovedAt.Should().Be(DateTime.Parse("2014-11-15T09:41:34.704Z").ToUniversalTime());

                    userFollowUserPostResponse.User.Should().BeNull();
                }
        }
 public async Task Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new UserFollowUserPostResponseObjectJsonReader();
     Func <Task <ITraktUserFollowUserPostResponse> > userFollowUserPostResponse = () => jsonReader.ReadObjectAsync(default(string));
     await userFollowUserPostResponse.Should().ThrowAsync <ArgumentNullException>();
 }
Esempio n. 15
0
        public void Test_UserFollowUserPostResponseObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new UserFollowUserPostResponseObjectJsonReader();
            Func <Task <ITraktUserFollowUserPostResponse> > userFollowUserPostResponse = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            userFollowUserPostResponse.Should().Throw <ArgumentNullException>();
        }