Пример #1
0
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            using (var stream = JSON_INCOMPLETE_2.ToStream())
            {
                var showCreditsCrewItems = await traktJsonReader.ReadArrayAsync(stream);

                showCreditsCrewItems.Should().NotBeNull();
                var items = showCreditsCrewItems.ToArray();

                items[0].Should().NotBeNull();
                items[0].Job.Should().Be("Director");
                items[0].Show.Should().NotBeNull();
                items[0].Show.Title.Should().Be("Game of Thrones");
                items[0].Show.Year.Should().Be(2011);
                items[0].Show.Ids.Should().NotBeNull();
                items[0].Show.Ids.Trakt.Should().Be(1390U);
                items[0].Show.Ids.Slug.Should().Be("game-of-thrones");
                items[0].Show.Ids.Tvdb.Should().Be(121361U);
                items[0].Show.Ids.Imdb.Should().Be("tt0944947");
                items[0].Show.Ids.Tmdb.Should().Be(1399U);
                items[0].Show.Ids.TvRage.Should().Be(24493U);

                items[1].Should().NotBeNull();
                items[1].Job.Should().Be("Producer");
                items[1].Show.Should().BeNull();
            }
        }
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

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

                    showCreditsCrewItems.Should().NotBeNull();
                    var items = showCreditsCrewItems.ToArray();

                    items[0].Should().NotBeNull();
                    items[0].Job.Should().BeNull();
                    items[0].Show.Should().NotBeNull();
                    items[0].Show.Title.Should().Be("Game of Thrones");
                    items[0].Show.Year.Should().Be(2011);
                    items[0].Show.Ids.Should().NotBeNull();
                    items[0].Show.Ids.Trakt.Should().Be(1390U);
                    items[0].Show.Ids.Slug.Should().Be("game-of-thrones");
                    items[0].Show.Ids.Tvdb.Should().Be(121361U);
                    items[0].Show.Ids.Imdb.Should().Be("tt0944947");
                    items[0].Show.Ids.Tmdb.Should().Be(1399U);
                    items[0].Show.Ids.TvRage.Should().Be(24493U);

                    items[1].Should().NotBeNull();
                    items[1].Job.Should().Be("Producer");
                    items[1].Show.Should().BeNull();
                }
        }
Пример #3
0
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_Json_String_Incomplete_1()
        {
            var jsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            var showCreditsCrewItems = await jsonReader.ReadArrayAsync(JSON_INCOMPLETE_1);

            showCreditsCrewItems.Should().NotBeNull();
            var items = showCreditsCrewItems.ToArray();

            items[0].Should().NotBeNull();
            items[0].Job.Should().BeNull();
            items[0].Show.Should().NotBeNull();
            items[0].Show.Title.Should().Be("Game of Thrones");
            items[0].Show.Year.Should().Be(2011);
            items[0].Show.Ids.Should().NotBeNull();
            items[0].Show.Ids.Trakt.Should().Be(1390U);
            items[0].Show.Ids.Slug.Should().Be("game-of-thrones");
            items[0].Show.Ids.Tvdb.Should().Be(121361U);
            items[0].Show.Ids.Imdb.Should().Be("tt0944947");
            items[0].Show.Ids.Tmdb.Should().Be(1399U);
            items[0].Show.Ids.TvRage.Should().Be(24493U);

            items[1].Should().NotBeNull();
            items[1].Job.Should().Be("Producer");
            items[1].Show.Should().NotBeNull();
            items[1].Show.Title.Should().Be("The Flash");
            items[1].Show.Year.Should().Be(2014);
            items[1].Show.Ids.Should().NotBeNull();
            items[1].Show.Ids.Trakt.Should().Be(60300U);
            items[1].Show.Ids.Slug.Should().Be("the-flash-2014");
            items[1].Show.Ids.Tvdb.Should().Be(279121U);
            items[1].Show.Ids.Imdb.Should().Be("tt3107288");
            items[1].Show.Ids.Tmdb.Should().Be(60735U);
            items[1].Show.Ids.TvRage.Should().Be(36939U);
        }
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            var showCreditsCrewItems = await traktJsonReader.ReadArrayAsync(default(JsonTextReader));

            showCreditsCrewItems.Should().BeNull();
        }
Пример #5
0
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            var showCreditsCrewItems = await jsonReader.ReadArrayAsync(string.Empty);

            showCreditsCrewItems.Should().BeNull();
        }
Пример #6
0
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadArray_From_Json_String_Empty_Array()
        {
            var jsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            var showCreditsCrewItems = await jsonReader.ReadArrayAsync(JSON_EMPTY_ARRAY);

            showCreditsCrewItems.Should().NotBeNull().And.BeEmpty();
        }
Пример #7
0
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            using (var stream = string.Empty.ToStream())
            {
                var showCreditsCrewItems = await traktJsonReader.ReadArrayAsync(stream);

                showCreditsCrewItems.Should().BeNull();
            }
        }
Пример #8
0
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadArray_From_Stream_Empty_Array()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            using (var stream = JSON_EMPTY_ARRAY.ToStream())
            {
                var showCreditsCrewItems = await traktJsonReader.ReadArrayAsync(stream);

                showCreditsCrewItems.Should().NotBeNull().And.BeEmpty();
            }
        }
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

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

                    showCreditsCrewItems.Should().BeNull();
                }
        }
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadArray_From_JsonReader_Empty_Array()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            using (var reader = new StringReader(JSON_EMPTY_ARRAY))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var showCreditsCrewItems = await traktJsonReader.ReadArrayAsync(jsonReader);

                    showCreditsCrewItems.Should().NotBeNull().And.BeEmpty();
                }
        }
Пример #11
0
        public async Task Test_PersonShowCreditsCrewItemArrayJsonReader_ReadObject_From_Stream_Not_Valid_1()
        {
            var traktJsonReader = new PersonShowCreditsCrewItemArrayJsonReader();

            using (var stream = JSON_NOT_VALID_1.ToStream())
            {
                var showCreditsCrewItems = await traktJsonReader.ReadArrayAsync(stream);

                showCreditsCrewItems.Should().NotBeNull();
                var items = showCreditsCrewItems.ToArray();

                items[0].Should().NotBeNull();
                items[0].Job.Should().BeNull();
                items[0].Show.Should().NotBeNull();
                items[0].Show.Title.Should().Be("Game of Thrones");
                items[0].Show.Year.Should().Be(2011);
                items[0].Show.Ids.Should().NotBeNull();
                items[0].Show.Ids.Trakt.Should().Be(1390U);
                items[0].Show.Ids.Slug.Should().Be("game-of-thrones");
                items[0].Show.Ids.Tvdb.Should().Be(121361U);
                items[0].Show.Ids.Imdb.Should().Be("tt0944947");
                items[0].Show.Ids.Tmdb.Should().Be(1399U);
                items[0].Show.Ids.TvRage.Should().Be(24493U);

                items[1].Should().NotBeNull();
                items[1].Job.Should().Be("Producer");
                items[1].Show.Should().NotBeNull();
                items[1].Show.Title.Should().Be("The Flash");
                items[1].Show.Year.Should().Be(2014);
                items[1].Show.Ids.Should().NotBeNull();
                items[1].Show.Ids.Trakt.Should().Be(60300U);
                items[1].Show.Ids.Slug.Should().Be("the-flash-2014");
                items[1].Show.Ids.Tvdb.Should().Be(279121U);
                items[1].Show.Ids.Imdb.Should().Be("tt3107288");
                items[1].Show.Ids.Tmdb.Should().Be(60735U);
                items[1].Show.Ids.TvRage.Should().Be(36939U);
            }
        }