public async Task Test_UserFriendObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new UserFriendObjectJsonReader();

            var userFriend = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

            userFriend.Should().NotBeNull();
            userFriend.FriendsAt.Should().BeNull();

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

            userFriend.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new UserFriendObjectJsonReader();

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

            userFriend.Should().BeNull();
        }
Example #4
0
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new UserFriendObjectJsonReader();

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

            userFriend.Should().BeNull();
        }
Example #5
0
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new UserFriendObjectJsonReader();

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

            userFriend.Should().BeNull();
        }
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new UserFriendObjectJsonReader();

            var userFriend = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            userFriend.Should().NotBeNull();
            userFriend.FriendsAt.Should().BeNull();
            userFriend.User.Should().BeNull();
        }
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new UserFriendObjectJsonReader();

            var userFriend = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            userFriend.Should().NotBeNull();
            userFriend.FriendsAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());

            userFriend.User.Should().BeNull();
        }
Example #8
0
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new UserFriendObjectJsonReader();

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

                userFriend.Should().BeNull();
            }
        }
Example #9
0
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new UserFriendObjectJsonReader();

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

                    userFriend.Should().BeNull();
                }
        }
Example #10
0
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new UserFriendObjectJsonReader();

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

                userFriend.Should().NotBeNull();
                userFriend.FriendsAt.Should().BeNull();
                userFriend.User.Should().BeNull();
            }
        }
Example #11
0
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new UserFriendObjectJsonReader();

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

                userFriend.Should().NotBeNull();
                userFriend.FriendsAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());

                userFriend.User.Should().BeNull();
            }
        }
Example #12
0
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new UserFriendObjectJsonReader();

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

                    userFriend.Should().NotBeNull();
                    userFriend.FriendsAt.Should().BeNull();
                    userFriend.User.Should().BeNull();
                }
        }
Example #13
0
        public async Task Test_UserFriendObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_2()
        {
            var traktJsonReader = new UserFriendObjectJsonReader();

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

                    userFriend.Should().NotBeNull();
                    userFriend.FriendsAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime());

                    userFriend.User.Should().BeNull();
                }
        }
Example #14
0
 public async Task Test_UserFriendObjectJsonReader_ReadObject_From_Stream_Null()
 {
     var jsonReader = new UserFriendObjectJsonReader();
     Func <Task <ITraktUserFriend> > userFriend = () => jsonReader.ReadObjectAsync(default(Stream));
     await userFriend.Should().ThrowAsync <ArgumentNullException>();
 }