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

            using (var stream = JSON_INCOMPLETE_3.ToStream())
            {
                var traktMostPWCShow = await traktJsonReader.ReadObjectAsync(stream);

                traktMostPWCShow.Should().NotBeNull();
                traktMostPWCShow.WatcherCount.Should().Be(4992);
                traktMostPWCShow.PlayCount.Should().Be(7100);
                traktMostPWCShow.CollectedCount.Should().BeNull();
                traktMostPWCShow.CollectorCount.Should().Be(7964);
                traktMostPWCShow.Show.Should().NotBeNull();
                traktMostPWCShow.Show.Title.Should().Be("Game of Thrones");
                traktMostPWCShow.Show.Year.Should().Be(2011);
                traktMostPWCShow.Show.Ids.Should().NotBeNull();
                traktMostPWCShow.Show.Ids.Trakt.Should().Be(1390U);
                traktMostPWCShow.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktMostPWCShow.Show.Ids.Tvdb.Should().Be(121361U);
                traktMostPWCShow.Show.Ids.Imdb.Should().Be("tt0944947");
                traktMostPWCShow.Show.Ids.Tmdb.Should().Be(1399U);
                traktMostPWCShow.Show.Ids.TvRage.Should().Be(24493U);
            }
        }
Пример #2
0
        public void Test_MostPWCShowObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();
            Func <Task <ITraktMostPWCShow> > traktMostPWCShow = () => traktJsonReader.ReadObjectAsync(default(Stream));

            traktMostPWCShow.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new MostPWCShowObjectJsonReader();

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

            traktMostPWCShow.Should().BeNull();
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

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

            traktMostPWCShow.Should().BeNull();
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

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

                traktMostPWCShow.Should().BeNull();
            }
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

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

                    traktMostPWCShow.Should().BeNull();
                }
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Json_String_Not_Valid_6()
        {
            var jsonReader = new MostPWCShowObjectJsonReader();

            var traktMostPWCShow = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_6);

            traktMostPWCShow.Should().NotBeNull();
            traktMostPWCShow.WatcherCount.Should().BeNull();
            traktMostPWCShow.PlayCount.Should().BeNull();
            traktMostPWCShow.CollectedCount.Should().BeNull();
            traktMostPWCShow.CollectorCount.Should().BeNull();
            traktMostPWCShow.Show.Should().BeNull();
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Json_String_Incomplete_9()
        {
            var jsonReader = new MostPWCShowObjectJsonReader();

            var traktMostPWCShow = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_9);

            traktMostPWCShow.Should().NotBeNull();
            traktMostPWCShow.WatcherCount.Should().BeNull();
            traktMostPWCShow.PlayCount.Should().BeNull();
            traktMostPWCShow.CollectedCount.Should().BeNull();
            traktMostPWCShow.CollectorCount.Should().Be(7964);
            traktMostPWCShow.Show.Should().BeNull();
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktMostPWCShow = await traktJsonReader.ReadObjectAsync(stream);

                traktMostPWCShow.Should().NotBeNull();
                traktMostPWCShow.WatcherCount.Should().BeNull();
                traktMostPWCShow.PlayCount.Should().BeNull();
                traktMostPWCShow.CollectedCount.Should().BeNull();
                traktMostPWCShow.CollectorCount.Should().BeNull();
                traktMostPWCShow.Show.Should().BeNull();
            }
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Stream_Incomplete_9()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_9.ToStream())
            {
                var traktMostPWCShow = await traktJsonReader.ReadObjectAsync(stream);

                traktMostPWCShow.Should().NotBeNull();
                traktMostPWCShow.WatcherCount.Should().BeNull();
                traktMostPWCShow.PlayCount.Should().BeNull();
                traktMostPWCShow.CollectedCount.Should().BeNull();
                traktMostPWCShow.CollectorCount.Should().Be(7964);
                traktMostPWCShow.Show.Should().BeNull();
            }
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_6()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

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

                    traktMostPWCShow.Should().NotBeNull();
                    traktMostPWCShow.WatcherCount.Should().BeNull();
                    traktMostPWCShow.PlayCount.Should().BeNull();
                    traktMostPWCShow.CollectedCount.Should().BeNull();
                    traktMostPWCShow.CollectorCount.Should().BeNull();
                    traktMostPWCShow.Show.Should().BeNull();
                }
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_JsonReader_Incomplete_9()
        {
            var traktJsonReader = new MostPWCShowObjectJsonReader();

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

                    traktMostPWCShow.Should().NotBeNull();
                    traktMostPWCShow.WatcherCount.Should().BeNull();
                    traktMostPWCShow.PlayCount.Should().BeNull();
                    traktMostPWCShow.CollectedCount.Should().BeNull();
                    traktMostPWCShow.CollectorCount.Should().Be(7964);
                    traktMostPWCShow.Show.Should().BeNull();
                }
        }
        public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Json_String_Not_Valid_4()
        {
            var jsonReader = new MostPWCShowObjectJsonReader();

            var traktMostPWCShow = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_4);

            traktMostPWCShow.Should().NotBeNull();
            traktMostPWCShow.WatcherCount.Should().Be(4992);
            traktMostPWCShow.PlayCount.Should().Be(7100);
            traktMostPWCShow.CollectedCount.Should().Be(1348);
            traktMostPWCShow.CollectorCount.Should().BeNull();
            traktMostPWCShow.Show.Should().NotBeNull();
            traktMostPWCShow.Show.Title.Should().Be("Game of Thrones");
            traktMostPWCShow.Show.Year.Should().Be(2011);
            traktMostPWCShow.Show.Ids.Should().NotBeNull();
            traktMostPWCShow.Show.Ids.Trakt.Should().Be(1390U);
            traktMostPWCShow.Show.Ids.Slug.Should().Be("game-of-thrones");
            traktMostPWCShow.Show.Ids.Tvdb.Should().Be(121361U);
            traktMostPWCShow.Show.Ids.Imdb.Should().Be("tt0944947");
            traktMostPWCShow.Show.Ids.Tmdb.Should().Be(1399U);
            traktMostPWCShow.Show.Ids.TvRage.Should().Be(24493U);
        }
 public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new MostPWCShowObjectJsonReader();
     Func <Task <ITraktMostPWCShow> > traktMostPWCShow = () => jsonReader.ReadObjectAsync(default(string));
     await traktMostPWCShow.Should().ThrowAsync <ArgumentNullException>();
 }
        public async Task Test_TraktMostPWCShow_From_Minimal_Json()
        {
            var jsonReader  = new MostPWCShowObjectJsonReader();
            var mostPWCShow = await jsonReader.ReadObjectAsync(MINIMAL_JSON) as TraktMostPWCShow;

            mostPWCShow.Should().NotBeNull();
            mostPWCShow.WatcherCount.Should().Be(4992);
            mostPWCShow.PlayCount.Should().Be(7100);
            mostPWCShow.CollectedCount.Should().Be(1348);
            mostPWCShow.CollectorCount.Should().Be(7964);

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

            mostPWCShow.Title.Should().Be("Game of Thrones");
            mostPWCShow.Year.Should().Be(2011);
            mostPWCShow.Airs.Should().BeNull();
            mostPWCShow.AvailableTranslationLanguageCodes.Should().BeNull();
            mostPWCShow.Ids.Should().NotBeNull();
            mostPWCShow.Ids.Trakt.Should().Be(1390U);
            mostPWCShow.Ids.Slug.Should().Be("game-of-thrones");
            mostPWCShow.Ids.Tvdb.Should().Be(121361U);
            mostPWCShow.Ids.Imdb.Should().Be("tt0944947");
            mostPWCShow.Ids.Tmdb.Should().Be(1399U);
            mostPWCShow.Ids.TvRage.Should().Be(24493U);
            mostPWCShow.Genres.Should().BeNull();
            mostPWCShow.Seasons.Should().BeNull();
            mostPWCShow.Overview.Should().BeNullOrEmpty();
            mostPWCShow.FirstAired.Should().NotHaveValue();
            mostPWCShow.Runtime.Should().NotHaveValue();
            mostPWCShow.Certification.Should().BeNullOrEmpty();
            mostPWCShow.Network.Should().BeNullOrEmpty();
            mostPWCShow.CountryCode.Should().BeNullOrEmpty();
            mostPWCShow.UpdatedAt.Should().NotHaveValue();
            mostPWCShow.Trailer.Should().BeNullOrEmpty();
            mostPWCShow.Homepage.Should().BeNullOrEmpty();
            mostPWCShow.Status.Should().BeNull();
            mostPWCShow.Rating.Should().NotHaveValue();
            mostPWCShow.Votes.Should().NotHaveValue();
            mostPWCShow.LanguageCode.Should().BeNullOrEmpty();
            mostPWCShow.AiredEpisodes.Should().NotHaveValue();
        }
        public async Task Test_TraktMostPWCShow_From_Full_Json()
        {
            var jsonReader  = new MostPWCShowObjectJsonReader();
            var mostPWCShow = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktMostPWCShow;

            mostPWCShow.Should().NotBeNull();
            mostPWCShow.WatcherCount.Should().Be(4992);
            mostPWCShow.PlayCount.Should().Be(7100);
            mostPWCShow.CollectedCount.Should().Be(1348);
            mostPWCShow.CollectorCount.Should().Be(7964);

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

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