コード例 #1
0
        public void Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new MostAnticipatedShowObjectJsonReader();
            Func <Task <ITraktMostAnticipatedShow> > traktMostAnticipatedShow = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktMostAnticipatedShow.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new MostAnticipatedShowObjectJsonReader();

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

            traktMostAnticipatedShow.Should().BeNull();
        }
コード例 #3
0
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new MostAnticipatedShowObjectJsonReader();

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

            traktMostAnticipatedShow.Should().BeNull();
        }
コード例 #4
0
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new MostAnticipatedShowObjectJsonReader();

            var traktMostAnticipatedShow = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            traktMostAnticipatedShow.Should().NotBeNull();
            traktMostAnticipatedShow.ListCount.Should().Be(12805);
            traktMostAnticipatedShow.Show.Should().BeNull();
        }
コード例 #5
0
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_Json_String_Incomplete_1()
        {
            var jsonReader = new MostAnticipatedShowObjectJsonReader();

            var traktMostAnticipatedShow = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_1);

            traktMostAnticipatedShow.Should().NotBeNull();
            traktMostAnticipatedShow.ListCount.Should().Be(12805);
            traktMostAnticipatedShow.Show.Should().BeNull();
        }
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new MostAnticipatedShowObjectJsonReader();

            using (var stream = string.Empty.ToStream())
            {
                var traktMostAnticipatedShow = await traktJsonReader.ReadObjectAsync(stream);

                traktMostAnticipatedShow.Should().BeNull();
            }
        }
コード例 #7
0
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new MostAnticipatedShowObjectJsonReader();

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

                    traktMostAnticipatedShow.Should().BeNull();
                }
        }
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new MostAnticipatedShowObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var traktMostAnticipatedShow = await traktJsonReader.ReadObjectAsync(stream);

                traktMostAnticipatedShow.Should().NotBeNull();
                traktMostAnticipatedShow.ListCount.Should().BeNull();
                traktMostAnticipatedShow.Show.Should().BeNull();
            }
        }
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_Stream_Incomplete_1()
        {
            var traktJsonReader = new MostAnticipatedShowObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_1.ToStream())
            {
                var traktMostAnticipatedShow = await traktJsonReader.ReadObjectAsync(stream);

                traktMostAnticipatedShow.Should().NotBeNull();
                traktMostAnticipatedShow.ListCount.Should().Be(12805);
                traktMostAnticipatedShow.Show.Should().BeNull();
            }
        }
コード例 #10
0
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new MostAnticipatedShowObjectJsonReader();

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

                    traktMostAnticipatedShow.Should().NotBeNull();
                    traktMostAnticipatedShow.ListCount.Should().Be(12805);
                    traktMostAnticipatedShow.Show.Should().BeNull();
                }
        }
コード例 #11
0
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new MostAnticipatedShowObjectJsonReader();

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

                    traktMostAnticipatedShow.Should().NotBeNull();
                    traktMostAnticipatedShow.ListCount.Should().BeNull();
                    traktMostAnticipatedShow.Show.Should().BeNull();
                }
        }
コード例 #12
0
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new MostAnticipatedShowObjectJsonReader();

            var traktMostAnticipatedShow = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

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

            using (var stream = JSON_INCOMPLETE_2.ToStream())
            {
                var traktMostAnticipatedShow = await traktJsonReader.ReadObjectAsync(stream);

                traktMostAnticipatedShow.Should().NotBeNull();
                traktMostAnticipatedShow.ListCount.Should().BeNull();
                traktMostAnticipatedShow.Show.Should().NotBeNull();
                traktMostAnticipatedShow.Show.Title.Should().Be("Game of Thrones");
                traktMostAnticipatedShow.Show.Year.Should().Be(2011);
                traktMostAnticipatedShow.Show.Ids.Should().NotBeNull();
                traktMostAnticipatedShow.Show.Ids.Trakt.Should().Be(1390U);
                traktMostAnticipatedShow.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktMostAnticipatedShow.Show.Ids.Tvdb.Should().Be(121361U);
                traktMostAnticipatedShow.Show.Ids.Imdb.Should().Be("tt0944947");
                traktMostAnticipatedShow.Show.Ids.Tmdb.Should().Be(1399U);
                traktMostAnticipatedShow.Show.Ids.TvRage.Should().Be(24493U);
            }
        }
コード例 #14
0
        public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new MostAnticipatedShowObjectJsonReader();

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

                    traktMostAnticipatedShow.Should().NotBeNull();
                    traktMostAnticipatedShow.ListCount.Should().Be(12805);
                    traktMostAnticipatedShow.Show.Should().NotBeNull();
                    traktMostAnticipatedShow.Show.Title.Should().Be("Game of Thrones");
                    traktMostAnticipatedShow.Show.Year.Should().Be(2011);
                    traktMostAnticipatedShow.Show.Ids.Should().NotBeNull();
                    traktMostAnticipatedShow.Show.Ids.Trakt.Should().Be(1390U);
                    traktMostAnticipatedShow.Show.Ids.Slug.Should().Be("game-of-thrones");
                    traktMostAnticipatedShow.Show.Ids.Tvdb.Should().Be(121361U);
                    traktMostAnticipatedShow.Show.Ids.Imdb.Should().Be("tt0944947");
                    traktMostAnticipatedShow.Show.Ids.Tmdb.Should().Be(1399U);
                    traktMostAnticipatedShow.Show.Ids.TvRage.Should().Be(24493U);
                }
        }
コード例 #15
0
        public async Task Test_TraktMostAnticipatedShow_From_Full_Json()
        {
            var jsonReader      = new MostAnticipatedShowObjectJsonReader();
            var anticipatedShow = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktMostAnticipatedShow;

            anticipatedShow.Should().NotBeNull();
            anticipatedShow.ListCount.Should().Be(12805);

            anticipatedShow.Show.Should().NotBeNull();
            anticipatedShow.Show.Title.Should().Be("Game of Thrones");
            anticipatedShow.Show.Year.Should().Be(2011);
            anticipatedShow.Show.Airs.Should().NotBeNull();
            anticipatedShow.Show.Airs.Day.Should().Be("Sunday");
            anticipatedShow.Show.Airs.Time.Should().Be("21:00");
            anticipatedShow.Show.Airs.TimeZoneId.Should().Be("America/New_York");
            anticipatedShow.Show.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "fr", "it", "de");
            anticipatedShow.Show.Ids.Should().NotBeNull();
            anticipatedShow.Show.Ids.Trakt.Should().Be(1390U);
            anticipatedShow.Show.Ids.Slug.Should().Be("game-of-thrones");
            anticipatedShow.Show.Ids.Tvdb.Should().Be(121361U);
            anticipatedShow.Show.Ids.Imdb.Should().Be("tt0944947");
            anticipatedShow.Show.Ids.Tmdb.Should().Be(1399U);
            anticipatedShow.Show.Ids.TvRage.Should().Be(24493U);
            anticipatedShow.Show.Genres.Should().NotBeNull().And.HaveCount(5).And.Contain("drama", "fantasy", "science-fiction", "action", "adventure");
            anticipatedShow.Show.Seasons.Should().BeNull();
            anticipatedShow.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.");
            anticipatedShow.Show.FirstAired.Should().Be(DateTime.Parse("2011-04-17T07:00:00Z").ToUniversalTime());
            anticipatedShow.Show.Runtime.Should().Be(60);
            anticipatedShow.Show.Certification.Should().Be("TV-MA");
            anticipatedShow.Show.Network.Should().Be("HBO");
            anticipatedShow.Show.CountryCode.Should().Be("us");
            anticipatedShow.Show.UpdatedAt.Should().Be(DateTime.Parse("2016-04-06T10:39:11Z").ToUniversalTime());
            anticipatedShow.Show.Trailer.Should().Be("http://youtube.com/watch?v=F9Bo89m2f6g");
            anticipatedShow.Show.Homepage.Should().Be("http://www.hbo.com/game-of-thrones");
            anticipatedShow.Show.Status.Should().Be(TraktShowStatus.ReturningSeries);
            anticipatedShow.Show.Rating.Should().Be(9.38327f);
            anticipatedShow.Show.Votes.Should().Be(44773);
            anticipatedShow.Show.LanguageCode.Should().Be("en");
            anticipatedShow.Show.AiredEpisodes.Should().Be(50);

            anticipatedShow.Title.Should().Be("Game of Thrones");
            anticipatedShow.Year.Should().Be(2011);
            anticipatedShow.Airs.Should().NotBeNull();
            anticipatedShow.Airs.Day.Should().Be("Sunday");
            anticipatedShow.Airs.Time.Should().Be("21:00");
            anticipatedShow.Airs.TimeZoneId.Should().Be("America/New_York");
            anticipatedShow.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "fr", "it", "de");
            anticipatedShow.Ids.Should().NotBeNull();
            anticipatedShow.Ids.Trakt.Should().Be(1390U);
            anticipatedShow.Ids.Slug.Should().Be("game-of-thrones");
            anticipatedShow.Ids.Tvdb.Should().Be(121361U);
            anticipatedShow.Ids.Imdb.Should().Be("tt0944947");
            anticipatedShow.Ids.Tmdb.Should().Be(1399U);
            anticipatedShow.Ids.TvRage.Should().Be(24493U);
            anticipatedShow.Genres.Should().NotBeNull().And.HaveCount(5).And.Contain("drama", "fantasy", "science-fiction", "action", "adventure");
            anticipatedShow.Seasons.Should().BeNull();
            anticipatedShow.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.");
            anticipatedShow.FirstAired.Should().Be(DateTime.Parse("2011-04-17T07:00:00Z").ToUniversalTime());
            anticipatedShow.Runtime.Should().Be(60);
            anticipatedShow.Certification.Should().Be("TV-MA");
            anticipatedShow.Network.Should().Be("HBO");
            anticipatedShow.CountryCode.Should().Be("us");
            anticipatedShow.UpdatedAt.Should().Be(DateTime.Parse("2016-04-06T10:39:11Z").ToUniversalTime());
            anticipatedShow.Trailer.Should().Be("http://youtube.com/watch?v=F9Bo89m2f6g");
            anticipatedShow.Homepage.Should().Be("http://www.hbo.com/game-of-thrones");
            anticipatedShow.Status.Should().Be(TraktShowStatus.ReturningSeries);
            anticipatedShow.Rating.Should().Be(9.38327f);
            anticipatedShow.Votes.Should().Be(44773);
            anticipatedShow.LanguageCode.Should().Be("en");
            anticipatedShow.AiredEpisodes.Should().Be(50);
        }
コード例 #16
0
 public async Task Test_MostAnticipatedShowObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new MostAnticipatedShowObjectJsonReader();
     Func <Task <ITraktMostAnticipatedShow> > traktMostAnticipatedShow = () => jsonReader.ReadObjectAsync(default(string));
     await traktMostAnticipatedShow.Should().ThrowAsync <ArgumentNullException>();
 }
コード例 #17
0
        public async Task Test_TraktMostAnticipatedShow_From_Minimal_Json()
        {
            var jsonReader      = new MostAnticipatedShowObjectJsonReader();
            var anticipatedShow = await jsonReader.ReadObjectAsync(MINIMAL_JSON) as TraktMostAnticipatedShow;

            anticipatedShow.Should().NotBeNull();
            anticipatedShow.ListCount.Should().Be(12805);

            anticipatedShow.Show.Should().NotBeNull();
            anticipatedShow.Show.Title.Should().Be("Game of Thrones");
            anticipatedShow.Show.Year.Should().Be(2011);
            anticipatedShow.Show.Airs.Should().BeNull();
            anticipatedShow.Show.AvailableTranslationLanguageCodes.Should().BeNull();
            anticipatedShow.Show.Ids.Should().NotBeNull();
            anticipatedShow.Show.Ids.Trakt.Should().Be(1390U);
            anticipatedShow.Show.Ids.Slug.Should().Be("game-of-thrones");
            anticipatedShow.Show.Ids.Tvdb.Should().Be(121361U);
            anticipatedShow.Show.Ids.Imdb.Should().Be("tt0944947");
            anticipatedShow.Show.Ids.Tmdb.Should().Be(1399U);
            anticipatedShow.Show.Ids.TvRage.Should().Be(24493U);
            anticipatedShow.Show.Genres.Should().BeNull();
            anticipatedShow.Show.Seasons.Should().BeNull();
            anticipatedShow.Show.Overview.Should().BeNullOrEmpty();
            anticipatedShow.Show.FirstAired.Should().NotHaveValue();
            anticipatedShow.Show.Runtime.Should().NotHaveValue();
            anticipatedShow.Show.Certification.Should().BeNullOrEmpty();
            anticipatedShow.Show.Network.Should().BeNullOrEmpty();
            anticipatedShow.Show.CountryCode.Should().BeNullOrEmpty();
            anticipatedShow.Show.UpdatedAt.Should().NotHaveValue();
            anticipatedShow.Show.Trailer.Should().BeNullOrEmpty();
            anticipatedShow.Show.Homepage.Should().BeNullOrEmpty();
            anticipatedShow.Show.Status.Should().BeNull();
            anticipatedShow.Show.Rating.Should().NotHaveValue();
            anticipatedShow.Show.Votes.Should().NotHaveValue();
            anticipatedShow.Show.LanguageCode.Should().BeNullOrEmpty();
            anticipatedShow.Show.AiredEpisodes.Should().NotHaveValue();

            anticipatedShow.Title.Should().Be("Game of Thrones");
            anticipatedShow.Year.Should().Be(2011);
            anticipatedShow.Airs.Should().BeNull();
            anticipatedShow.AvailableTranslationLanguageCodes.Should().BeNull();
            anticipatedShow.Ids.Should().NotBeNull();
            anticipatedShow.Ids.Trakt.Should().Be(1390U);
            anticipatedShow.Ids.Slug.Should().Be("game-of-thrones");
            anticipatedShow.Ids.Tvdb.Should().Be(121361U);
            anticipatedShow.Ids.Imdb.Should().Be("tt0944947");
            anticipatedShow.Ids.Tmdb.Should().Be(1399U);
            anticipatedShow.Ids.TvRage.Should().Be(24493U);
            anticipatedShow.Genres.Should().BeNull();
            anticipatedShow.Seasons.Should().BeNull();
            anticipatedShow.Overview.Should().BeNullOrEmpty();
            anticipatedShow.FirstAired.Should().NotHaveValue();
            anticipatedShow.Runtime.Should().NotHaveValue();
            anticipatedShow.Certification.Should().BeNullOrEmpty();
            anticipatedShow.Network.Should().BeNullOrEmpty();
            anticipatedShow.CountryCode.Should().BeNullOrEmpty();
            anticipatedShow.UpdatedAt.Should().NotHaveValue();
            anticipatedShow.Trailer.Should().BeNullOrEmpty();
            anticipatedShow.Homepage.Should().BeNullOrEmpty();
            anticipatedShow.Status.Should().BeNull();
            anticipatedShow.Rating.Should().NotHaveValue();
            anticipatedShow.Votes.Should().NotHaveValue();
            anticipatedShow.LanguageCode.Should().BeNullOrEmpty();
            anticipatedShow.AiredEpisodes.Should().NotHaveValue();
        }