コード例 #1
0
        public void Test_AccountSettingsObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new AccountSettingsObjectJsonReader();
            Func <Task <ITraktAccountSettings> > userAccountSettings = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            userAccountSettings.Should().Throw <ArgumentNullException>();
        }
コード例 #2
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new AccountSettingsObjectJsonReader();

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

            userAccountSettings.Should().BeNull();
        }
コード例 #3
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

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

            userAccountSettings.Should().BeNull();
        }
コード例 #4
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

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

            userAccountSettings.Should().BeNull();
        }
コード例 #5
0
        public async Task Test_TraktAccountSettings_From_Json()
        {
            var jsonReader      = new AccountSettingsObjectJsonReader();
            var accountSettings = await jsonReader.ReadObjectAsync(JSON) as TraktAccountSettings;

            accountSettings.Should().NotBeNull();
            accountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
            accountSettings.Time24Hr.Should().BeTrue();
            accountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
            accountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
        }
コード例 #6
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

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

                userAccountSettings.Should().BeNull();
            }
        }
コード例 #7
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new AccountSettingsObjectJsonReader();

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

                    userAccountSettings.Should().BeNull();
                }
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Incomplete_4()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            var userAccountSettings = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_4);

            userAccountSettings.Should().NotBeNull();
            userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
            userAccountSettings.Time24Hr.Should().BeTrue();
            userAccountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
            userAccountSettings.Token.Should().BeNull();
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Incomplete_3()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            var userAccountSettings = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_3);

            userAccountSettings.Should().NotBeNull();
            userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
            userAccountSettings.Time24Hr.Should().BeTrue();
            userAccountSettings.CoverImage.Should().BeNull();
            userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Not_Valid_5()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            var userAccountSettings = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_5);

            userAccountSettings.Should().NotBeNull();
            userAccountSettings.TimeZoneId.Should().BeNull();
            userAccountSettings.Time24Hr.Should().BeNull();
            userAccountSettings.CoverImage.Should().BeNull();
            userAccountSettings.Token.Should().BeNull();
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            var userAccountSettings = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            userAccountSettings.Should().NotBeNull();
            userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
            userAccountSettings.Time24Hr.Should().BeNull();
            userAccountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
            userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Incomplete_6()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            var userAccountSettings = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_6);

            userAccountSettings.Should().NotBeNull();
            userAccountSettings.TimeZoneId.Should().BeNull();
            userAccountSettings.Time24Hr.Should().BeTrue();
            userAccountSettings.CoverImage.Should().BeNull();
            userAccountSettings.Token.Should().BeNull();
        }
コード例 #13
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Incomplete_10()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            var userAccountSettings = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_10);

            userAccountSettings.Should().NotBeNull();
            userAccountSettings.TimeZoneId.Should().BeNull();
            userAccountSettings.Time24Hr.Should().BeNull();
            userAccountSettings.CoverImage.Should().BeNull();
            userAccountSettings.Token.Should().BeNull();
            userAccountSettings.DateFormat.Should().NotBeNull().And.Be(TraktDateFormat.DayMonthYear);
        }
コード例 #14
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            var userAccountSettings = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            userAccountSettings.Should().NotBeNull();
            userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
            userAccountSettings.Time24Hr.Should().BeTrue();
            userAccountSettings.CoverImage.Should().BeNull();
            userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
            userAccountSettings.DateFormat.Should().NotBeNull().And.Be(TraktDateFormat.DayMonthYear);
        }
コード例 #15
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Not_Valid_4()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            var userAccountSettings = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_4);

            userAccountSettings.Should().NotBeNull();
            userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
            userAccountSettings.Time24Hr.Should().BeTrue();
            userAccountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
            userAccountSettings.Token.Should().BeNull();
            userAccountSettings.DateFormat.Should().NotBeNull().And.Be(TraktDateFormat.DayMonthYear);
        }
コード例 #16
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Json_String_Incomplete_1()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            var userAccountSettings = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_1);

            userAccountSettings.Should().NotBeNull();
            userAccountSettings.TimeZoneId.Should().BeNull();
            userAccountSettings.Time24Hr.Should().BeTrue();
            userAccountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
            userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
            userAccountSettings.DateFormat.Should().NotBeNull().And.Be(TraktDateFormat.DayMonthYear);
        }
コード例 #17
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Incomplete_5()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_5.ToStream())
            {
                var userAccountSettings = await jsonReader.ReadObjectAsync(stream);

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
                userAccountSettings.Time24Hr.Should().BeNull();
                userAccountSettings.CoverImage.Should().BeNull();
                userAccountSettings.Token.Should().BeNull();
            }
        }
コード例 #18
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

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

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
                userAccountSettings.Time24Hr.Should().BeNull();
                userAccountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
                userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
            }
        }
コード例 #19
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

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

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
                userAccountSettings.Time24Hr.Should().BeTrue();
                userAccountSettings.CoverImage.Should().BeNull();
                userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
            }
        }
コード例 #20
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Not_Valid_4()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

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

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
                userAccountSettings.Time24Hr.Should().BeTrue();
                userAccountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
                userAccountSettings.Token.Should().BeNull();
            }
        }
コード例 #21
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Incomplete_8()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_8.ToStream())
            {
                var userAccountSettings = await jsonReader.ReadObjectAsync(stream);

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().BeNull();
                userAccountSettings.Time24Hr.Should().BeNull();
                userAccountSettings.CoverImage.Should().BeNull();
                userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
            }
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Not_Valid_1()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

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

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().BeNull();
                userAccountSettings.Time24Hr.Should().BeTrue();
                userAccountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
                userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
                userAccountSettings.DateFormat.Should().NotBeNull().And.Be(TraktDateFormat.DayMonthYear);
            }
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Incomplete_3()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

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

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
                userAccountSettings.Time24Hr.Should().BeTrue();
                userAccountSettings.CoverImage.Should().BeNull();
                userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
                userAccountSettings.DateFormat.Should().NotBeNull().And.Be(TraktDateFormat.DayMonthYear);
            }
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Incomplete_4()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

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

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
                userAccountSettings.Time24Hr.Should().BeTrue();
                userAccountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
                userAccountSettings.Token.Should().BeNull();
                userAccountSettings.DateFormat.Should().NotBeNull().And.Be(TraktDateFormat.DayMonthYear);
            }
        }
コード例 #25
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_JsonReader_Incomplete_5()
        {
            var traktJsonReader = new AccountSettingsObjectJsonReader();

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

                    userAccountSettings.Should().NotBeNull();
                    userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
                    userAccountSettings.Time24Hr.Should().BeNull();
                    userAccountSettings.CoverImage.Should().BeNull();
                    userAccountSettings.Token.Should().BeNull();
                }
        }
コード例 #26
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_JsonReader_Incomplete_8()
        {
            var traktJsonReader = new AccountSettingsObjectJsonReader();

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

                    userAccountSettings.Should().NotBeNull();
                    userAccountSettings.TimeZoneId.Should().BeNull();
                    userAccountSettings.Time24Hr.Should().BeNull();
                    userAccountSettings.CoverImage.Should().BeNull();
                    userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
                }
        }
コード例 #27
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new AccountSettingsObjectJsonReader();

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

                    userAccountSettings.Should().NotBeNull();
                    userAccountSettings.TimeZoneId.Should().Be("America/Los_Angeles");
                    userAccountSettings.Time24Hr.Should().BeTrue();
                    userAccountSettings.CoverImage.Should().BeNull();
                    userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
                }
        }
コード例 #28
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_5()
        {
            var traktJsonReader = new AccountSettingsObjectJsonReader();

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

                    userAccountSettings.Should().NotBeNull();
                    userAccountSettings.TimeZoneId.Should().BeNull();
                    userAccountSettings.Time24Hr.Should().BeNull();
                    userAccountSettings.CoverImage.Should().BeNull();
                    userAccountSettings.Token.Should().BeNull();
                }
        }
コード例 #29
0
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new AccountSettingsObjectJsonReader();

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

                    userAccountSettings.Should().NotBeNull();
                    userAccountSettings.TimeZoneId.Should().BeNull();
                    userAccountSettings.Time24Hr.Should().BeTrue();
                    userAccountSettings.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042");
                    userAccountSettings.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24");
                }
        }
        public async Task Test_AccountSettingsObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var jsonReader = new AccountSettingsObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var userAccountSettings = await jsonReader.ReadObjectAsync(stream);

                userAccountSettings.Should().NotBeNull();
                userAccountSettings.TimeZoneId.Should().BeNull();
                userAccountSettings.Time24Hr.Should().BeNull();
                userAccountSettings.CoverImage.Should().BeNull();
                userAccountSettings.Token.Should().BeNull();
                userAccountSettings.DateFormat.Should().BeNull();
            }
        }