Ejemplo n.º 1
0
        public void Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new PersonShowCreditsCastItemObjectJsonReader();
            Func <Task <ITraktPersonShowCreditsCastItem> > showCreditsCastItem = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            showCreditsCastItem.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 2
0
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

            showCreditsCastItem.Should().BeNull();
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

            showCreditsCastItem.Should().BeNull();
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

            showCreditsCastItem.Should().BeNull();
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

            var showCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            showCreditsCastItem.Should().NotBeNull();
            showCreditsCastItem.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
            showCreditsCastItem.Show.Should().BeNull();
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

            using (var stream = string.Empty.ToStream())
            {
                var showCreditsCastItem = await jsonReader.ReadObjectAsync(stream);
                showCreditsCastItem.Should().BeNull();
            }
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

            var showCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            showCreditsCastItem.Should().NotBeNull();
            showCreditsCastItem.Characters.Should().BeNull();
            showCreditsCastItem.Show.Should().BeNull();
        }
Ejemplo n.º 8
0
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

            var showCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            showCreditsCastItem.Should().NotBeNull();
            showCreditsCastItem.Character.Should().Be("Joe Brody");
            showCreditsCastItem.Show.Should().BeNull();
        }
Ejemplo n.º 9
0
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

                    showCreditsCastItem.Should().BeNull();
                }
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

                showCreditsCastItem.Should().NotBeNull();
                showCreditsCastItem.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
                showCreditsCastItem.Show.Should().BeNull();
            }
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

                showCreditsCastItem.Should().NotBeNull();
                showCreditsCastItem.Characters.Should().BeNull();
                showCreditsCastItem.Show.Should().BeNull();
            }
        }
Ejemplo n.º 12
0
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

                    showCreditsCastItem.Should().NotBeNull();
                    showCreditsCastItem.Characters.Should().BeNull();
                    showCreditsCastItem.Show.Should().BeNull();
                }
        }
Ejemplo n.º 13
0
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

                    showCreditsCastItem.Should().NotBeNull();
                    showCreditsCastItem.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
                    showCreditsCastItem.Show.Should().BeNull();
                }
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Complete()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

            var showCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_COMPLETE);

            showCreditsCastItem.Should().NotBeNull();
            showCreditsCastItem.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
            showCreditsCastItem.Show.Should().NotBeNull();
            showCreditsCastItem.Show.Title.Should().Be("Game of Thrones");
            showCreditsCastItem.Show.Year.Should().Be(2011);
            showCreditsCastItem.Show.Ids.Should().NotBeNull();
            showCreditsCastItem.Show.Ids.Trakt.Should().Be(1390U);
            showCreditsCastItem.Show.Ids.Slug.Should().Be("game-of-thrones");
            showCreditsCastItem.Show.Ids.Tvdb.Should().Be(121361U);
            showCreditsCastItem.Show.Ids.Imdb.Should().Be("tt0944947");
            showCreditsCastItem.Show.Ids.Tmdb.Should().Be(1399U);
            showCreditsCastItem.Show.Ids.TvRage.Should().Be(24493U);
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

            var showCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

            showCreditsCastItem.Should().NotBeNull();
            showCreditsCastItem.Characters.Should().BeNull();
            showCreditsCastItem.Show.Should().NotBeNull();
            showCreditsCastItem.Show.Title.Should().Be("Game of Thrones");
            showCreditsCastItem.Show.Year.Should().Be(2011);
            showCreditsCastItem.Show.Ids.Should().NotBeNull();
            showCreditsCastItem.Show.Ids.Trakt.Should().Be(1390U);
            showCreditsCastItem.Show.Ids.Slug.Should().Be("game-of-thrones");
            showCreditsCastItem.Show.Ids.Tvdb.Should().Be(121361U);
            showCreditsCastItem.Show.Ids.Imdb.Should().Be("tt0944947");
            showCreditsCastItem.Show.Ids.Tmdb.Should().Be(1399U);
            showCreditsCastItem.Show.Ids.TvRage.Should().Be(24493U);
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Incomplete_1()
        {
            var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

                showCreditsCastItem.Should().NotBeNull();
                showCreditsCastItem.Characters.Should().BeNull();
                showCreditsCastItem.Show.Should().NotBeNull();
                showCreditsCastItem.Show.Title.Should().Be("Game of Thrones");
                showCreditsCastItem.Show.Year.Should().Be(2011);
                showCreditsCastItem.Show.Ids.Should().NotBeNull();
                showCreditsCastItem.Show.Ids.Trakt.Should().Be(1390U);
                showCreditsCastItem.Show.Ids.Slug.Should().Be("game-of-thrones");
                showCreditsCastItem.Show.Ids.Tvdb.Should().Be(121361U);
                showCreditsCastItem.Show.Ids.Imdb.Should().Be("tt0944947");
                showCreditsCastItem.Show.Ids.Tmdb.Should().Be(1399U);
                showCreditsCastItem.Show.Ids.TvRage.Should().Be(24493U);
            }
        }
Ejemplo n.º 17
0
        public async Task Test_TraktPersonShowCreditsCastItem_From_Full_Json()
        {
            var jsonReader      = new PersonShowCreditsCastItemObjectJsonReader();
            var creditsCastItem = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktPersonShowCreditsCastItem;

            creditsCastItem.Should().NotBeNull();
            creditsCastItem.Character.Should().Be("Joe Brody");
            creditsCastItem.Show.Should().NotBeNull();
            creditsCastItem.Show.Title.Should().Be("Game of Thrones");
            creditsCastItem.Show.Year.Should().Be(2011);
            creditsCastItem.Show.Airs.Should().NotBeNull();
            creditsCastItem.Show.Airs.Day.Should().Be("Sunday");
            creditsCastItem.Show.Airs.Time.Should().Be("21:00");
            creditsCastItem.Show.Airs.TimeZoneId.Should().Be("America/New_York");
            creditsCastItem.Show.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "fr", "it", "de");
            creditsCastItem.Show.Ids.Should().NotBeNull();
            creditsCastItem.Show.Ids.Trakt.Should().Be(1390U);
            creditsCastItem.Show.Ids.Slug.Should().Be("game-of-thrones");
            creditsCastItem.Show.Ids.Tvdb.Should().Be(121361U);
            creditsCastItem.Show.Ids.Imdb.Should().Be("tt0944947");
            creditsCastItem.Show.Ids.Tmdb.Should().Be(1399U);
            creditsCastItem.Show.Ids.TvRage.Should().Be(24493U);
            creditsCastItem.Show.Genres.Should().NotBeNull().And.HaveCount(5).And.Contain("drama", "fantasy", "science-fiction", "action", "adventure");
            creditsCastItem.Show.Seasons.Should().BeNull();
            creditsCastItem.Show.Overview.Should().Be("Seven noble families fight for control of the mythical land of Westeros. Friction between the houses leads to full-scale war. All while a very ancient evil awakens in the farthest north. Amidst the war, a neglected military order of misfits, the Night's Watch, is all that stands between the realms of men and the icy horrors beyond.");
            creditsCastItem.Show.FirstAired.Should().Be(DateTime.Parse("2011-04-17T07:00:00Z").ToUniversalTime());
            creditsCastItem.Show.Runtime.Should().Be(60);
            creditsCastItem.Show.Certification.Should().Be("TV-MA");
            creditsCastItem.Show.Network.Should().Be("HBO");
            creditsCastItem.Show.CountryCode.Should().Be("us");
            creditsCastItem.Show.UpdatedAt.Should().Be(DateTime.Parse("2016-04-06T10:39:11Z").ToUniversalTime());
            creditsCastItem.Show.Trailer.Should().Be("http://youtube.com/watch?v=F9Bo89m2f6g");
            creditsCastItem.Show.Homepage.Should().Be("http://www.hbo.com/game-of-thrones");
            creditsCastItem.Show.Status.Should().Be(TraktShowStatus.ReturningSeries);
            creditsCastItem.Show.Rating.Should().Be(9.38327f);
            creditsCastItem.Show.Votes.Should().Be(44773);
            creditsCastItem.Show.LanguageCode.Should().Be("en");
            creditsCastItem.Show.AiredEpisodes.Should().Be(50);
        }
        public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new PersonShowCreditsCastItemObjectJsonReader();

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

                    showCreditsCastItem.Should().NotBeNull();
                    showCreditsCastItem.Character.Should().Be("Joe Brody");
                    showCreditsCastItem.Show.Should().NotBeNull();
                    showCreditsCastItem.Show.Title.Should().Be("Game of Thrones");
                    showCreditsCastItem.Show.Year.Should().Be(2011);
                    showCreditsCastItem.Show.Ids.Should().NotBeNull();
                    showCreditsCastItem.Show.Ids.Trakt.Should().Be(1390U);
                    showCreditsCastItem.Show.Ids.Slug.Should().Be("game-of-thrones");
                    showCreditsCastItem.Show.Ids.Tvdb.Should().Be(121361U);
                    showCreditsCastItem.Show.Ids.Imdb.Should().Be("tt0944947");
                    showCreditsCastItem.Show.Ids.Tmdb.Should().Be(1399U);
                    showCreditsCastItem.Show.Ids.TvRage.Should().Be(24493U);
                }
        }
Ejemplo n.º 19
0
        public async Task Test_TraktPersonShowCreditsCastItem_From_Minimal_Json()
        {
            var jsonReader      = new PersonShowCreditsCastItemObjectJsonReader();
            var creditsCastItem = await jsonReader.ReadObjectAsync(MINIMAL_JSON) as TraktPersonShowCreditsCastItem;

            creditsCastItem.Should().NotBeNull();
            creditsCastItem.Character.Should().Be("Joe Brody");
            creditsCastItem.Show.Should().NotBeNull();
            creditsCastItem.Show.Title.Should().Be("Game of Thrones");
            creditsCastItem.Show.Year.Should().Be(2011);
            creditsCastItem.Show.Airs.Should().BeNull();
            creditsCastItem.Show.AvailableTranslationLanguageCodes.Should().BeNull();
            creditsCastItem.Show.Ids.Should().NotBeNull();
            creditsCastItem.Show.Ids.Trakt.Should().Be(1390U);
            creditsCastItem.Show.Ids.Slug.Should().Be("game-of-thrones");
            creditsCastItem.Show.Ids.Tvdb.Should().Be(121361U);
            creditsCastItem.Show.Ids.Imdb.Should().Be("tt0944947");
            creditsCastItem.Show.Ids.Tmdb.Should().Be(1399U);
            creditsCastItem.Show.Ids.TvRage.Should().Be(24493U);
            creditsCastItem.Show.Genres.Should().BeNull();
            creditsCastItem.Show.Seasons.Should().BeNull();
            creditsCastItem.Show.Overview.Should().BeNullOrEmpty();
            creditsCastItem.Show.FirstAired.Should().NotHaveValue();
            creditsCastItem.Show.Runtime.Should().NotHaveValue();
            creditsCastItem.Show.Certification.Should().BeNullOrEmpty();
            creditsCastItem.Show.Network.Should().BeNullOrEmpty();
            creditsCastItem.Show.CountryCode.Should().BeNullOrEmpty();
            creditsCastItem.Show.UpdatedAt.Should().NotHaveValue();
            creditsCastItem.Show.Trailer.Should().BeNullOrEmpty();
            creditsCastItem.Show.Homepage.Should().BeNullOrEmpty();
            creditsCastItem.Show.Status.Should().BeNull();
            creditsCastItem.Show.Rating.Should().NotHaveValue();
            creditsCastItem.Show.Votes.Should().NotHaveValue();
            creditsCastItem.Show.LanguageCode.Should().BeNullOrEmpty();
            creditsCastItem.Show.AiredEpisodes.Should().NotHaveValue();
        }
 public async Task Test_PersonShowCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Null()
 {
     var jsonReader = new PersonShowCreditsCastItemObjectJsonReader();
     Func<Task<ITraktPersonShowCreditsCastItem>> showCreditsCastItem = () => jsonReader.ReadObjectAsync(default(Stream));
     await showCreditsCastItem.Should().ThrowAsync<ArgumentNullException>();
 }