示例#1
0
        public void Test_CastMemberObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new CastMemberObjectJsonReader();
            Func <Task <ITraktCastMember> > traktCastMember = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktCastMember.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new CastMemberObjectJsonReader();

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

            traktCastMember.Should().BeNull();
        }
示例#3
0
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new CastMemberObjectJsonReader();

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

            traktCastMember.Should().BeNull();
        }
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new CastMemberObjectJsonReader();

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

            traktCastMember.Should().BeNull();
        }
示例#5
0
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new CastMemberObjectJsonReader();

            var traktCastMember = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            traktCastMember.Should().NotBeNull();
            traktCastMember.Character.Should().Be("Joe Brody");
            traktCastMember.Person.Should().BeNull();
        }
示例#6
0
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new CastMemberObjectJsonReader();

            var traktCastMember = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            traktCastMember.Should().NotBeNull();
            traktCastMember.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
            traktCastMember.Person.Should().BeNull();
        }
示例#7
0
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new CastMemberObjectJsonReader();

            var traktCastMember = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktCastMember.Should().NotBeNull();
            traktCastMember.Characters.Should().BeNull();
            traktCastMember.Person.Should().BeNull();
        }
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new CastMemberObjectJsonReader();

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

                traktCastMember.Should().BeNull();
            }
        }
示例#9
0
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new CastMemberObjectJsonReader();

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

                    traktCastMember.Should().BeNull();
                }
        }
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new CastMemberObjectJsonReader();

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

                traktCastMember.Should().NotBeNull();
                traktCastMember.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
                traktCastMember.Person.Should().BeNull();
            }
        }
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new CastMemberObjectJsonReader();

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

                traktCastMember.Should().NotBeNull();
                traktCastMember.Characters.Should().BeNull();
                traktCastMember.Person.Should().BeNull();
            }
        }
示例#12
0
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new CastMemberObjectJsonReader();

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

                    traktCastMember.Should().NotBeNull();
                    traktCastMember.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
                    traktCastMember.Person.Should().BeNull();
                }
        }
示例#13
0
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new CastMemberObjectJsonReader();

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

                    traktCastMember.Should().NotBeNull();
                    traktCastMember.Characters.Should().BeNull();
                    traktCastMember.Person.Should().BeNull();
                }
        }
示例#14
0
        public async Task Test_TraktCastMember_From_Json()
        {
            var jsonReader      = new CastMemberObjectJsonReader();
            var traktCastMember = await jsonReader.ReadObjectAsync(JSON) as TraktCastMember;

            traktCastMember.Should().NotBeNull();
            traktCastMember.Character.Should().Be("Joe Brody");
            traktCastMember.Person.Should().NotBeNull();
            traktCastMember.Person.Name.Should().Be("Bryan Cranston");
            traktCastMember.Person.Ids.Should().NotBeNull();
            traktCastMember.Person.Ids.Trakt.Should().Be(297737U);
            traktCastMember.Person.Ids.Slug.Should().Be("bryan-cranston");
            traktCastMember.Person.Ids.Imdb.Should().Be("nm0186505");
            traktCastMember.Person.Ids.Tmdb.Should().Be(17419U);
            traktCastMember.Person.Ids.TvRage.Should().Be(1797U);
        }
示例#15
0
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new CastMemberObjectJsonReader();

            var traktCastMember = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

            traktCastMember.Should().NotBeNull();
            traktCastMember.Characters.Should().BeNull();
            traktCastMember.Person.Should().NotBeNull();
            traktCastMember.Person.Name.Should().Be("Bryan Cranston");
            traktCastMember.Person.Ids.Should().NotBeNull();
            traktCastMember.Person.Ids.Trakt.Should().Be(297737U);
            traktCastMember.Person.Ids.Slug.Should().Be("bryan-cranston");
            traktCastMember.Person.Ids.Imdb.Should().Be("nm0186505");
            traktCastMember.Person.Ids.Tmdb.Should().Be(17419U);
            traktCastMember.Person.Ids.TvRage.Should().Be(1797U);
        }
示例#16
0
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Json_String_Complete()
        {
            var jsonReader = new CastMemberObjectJsonReader();

            var traktCastMember = await jsonReader.ReadObjectAsync(JSON_COMPLETE);

            traktCastMember.Should().NotBeNull();
            traktCastMember.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
            traktCastMember.Person.Should().NotBeNull();
            traktCastMember.Person.Name.Should().Be("Bryan Cranston");
            traktCastMember.Person.Ids.Should().NotBeNull();
            traktCastMember.Person.Ids.Trakt.Should().Be(297737U);
            traktCastMember.Person.Ids.Slug.Should().Be("bryan-cranston");
            traktCastMember.Person.Ids.Imdb.Should().Be("nm0186505");
            traktCastMember.Person.Ids.Tmdb.Should().Be(17419U);
            traktCastMember.Person.Ids.TvRage.Should().Be(1797U);
        }
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Stream_Incomplete_1()
        {
            var jsonReader = new CastMemberObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_1.ToStream())
            {
                var traktCastMember = await jsonReader.ReadObjectAsync(stream);

                traktCastMember.Should().NotBeNull();
                traktCastMember.Characters.Should().BeNull();
                traktCastMember.Person.Should().NotBeNull();
                traktCastMember.Person.Name.Should().Be("Bryan Cranston");
                traktCastMember.Person.Ids.Should().NotBeNull();
                traktCastMember.Person.Ids.Trakt.Should().Be(297737U);
                traktCastMember.Person.Ids.Slug.Should().Be("bryan-cranston");
                traktCastMember.Person.Ids.Imdb.Should().Be("nm0186505");
                traktCastMember.Person.Ids.Tmdb.Should().Be(17419U);
                traktCastMember.Person.Ids.TvRage.Should().Be(1797U);
            }
        }
        public async Task Test_CastMemberObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new CastMemberObjectJsonReader();

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

                    traktCastMember.Should().NotBeNull();
                    traktCastMember.Character.Should().Be("Joe Brody");
                    traktCastMember.Person.Should().NotBeNull();
                    traktCastMember.Person.Name.Should().Be("Bryan Cranston");
                    traktCastMember.Person.Ids.Should().NotBeNull();
                    traktCastMember.Person.Ids.Trakt.Should().Be(297737U);
                    traktCastMember.Person.Ids.Slug.Should().Be("bryan-cranston");
                    traktCastMember.Person.Ids.Imdb.Should().Be("nm0186505");
                    traktCastMember.Person.Ids.Tmdb.Should().Be(17419U);
                    traktCastMember.Person.Ids.TvRage.Should().Be(1797U);
                }
        }
 public async Task Test_CastMemberObjectJsonReader_ReadObject_From_Stream_Null()
 {
     var jsonReader = new CastMemberObjectJsonReader();
     Func <Task <ITraktCastMember> > traktCastMember = () => jsonReader.ReadObjectAsync(default(Stream));
     await traktCastMember.Should().ThrowAsync <ArgumentNullException>();
 }