コード例 #1
0
        public void Test_MostPWCMovieObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new MostPWCMovieObjectJsonReader();
            Func <Task <ITraktMostPWCMovie> > traktMostPWCMovie = () => jsonReader.ReadObjectAsync(default(string));

            traktMostPWCMovie.Should().Throw <ArgumentNullException>();
        }
コード例 #2
0
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new MostPWCMovieObjectJsonReader();

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

            traktMostPWCMovie.Should().BeNull();
        }
コード例 #3
0
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new MostPWCMovieObjectJsonReader();

            var traktMostPWCMovie = await traktJsonReader.ReadObjectAsync(default(Stream));

            traktMostPWCMovie.Should().BeNull();
        }
コード例 #4
0
        public async Task Test_TraktMostPWCMovie_From_Minimal_Json()
        {
            var jsonReader   = new MostPWCMovieObjectJsonReader();
            var mostPWCMovie = await jsonReader.ReadObjectAsync(MINIMAL_JSON) as TraktMostPWCMovie;

            mostPWCMovie.Should().NotBeNull();
            mostPWCMovie.WatcherCount.Should().Be(4992);
            mostPWCMovie.PlayCount.Should().Be(7100);
            mostPWCMovie.CollectedCount.Should().Be(1348);

            mostPWCMovie.Movie.Should().NotBeNull();
            mostPWCMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            mostPWCMovie.Movie.Year.Should().Be(2015);
            mostPWCMovie.Movie.Ids.Should().NotBeNull();
            mostPWCMovie.Movie.Ids.Trakt.Should().Be(94024U);
            mostPWCMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            mostPWCMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
            mostPWCMovie.Movie.Ids.Tmdb.Should().Be(140607U);
            mostPWCMovie.Movie.Tagline.Should().BeNullOrEmpty();
            mostPWCMovie.Movie.Overview.Should().BeNullOrEmpty();
            mostPWCMovie.Movie.Released.Should().NotHaveValue();
            mostPWCMovie.Movie.Runtime.Should().NotHaveValue();
            mostPWCMovie.Movie.UpdatedAt.Should().NotHaveValue();
            mostPWCMovie.Movie.Trailer.Should().BeNullOrEmpty();
            mostPWCMovie.Movie.Homepage.Should().BeNullOrEmpty();
            mostPWCMovie.Movie.Rating.Should().NotHaveValue();
            mostPWCMovie.Movie.Votes.Should().NotHaveValue();
            mostPWCMovie.Movie.LanguageCode.Should().BeNullOrEmpty();
            mostPWCMovie.Movie.AvailableTranslationLanguageCodes.Should().BeNull();
            mostPWCMovie.Movie.Genres.Should().BeNull();
            mostPWCMovie.Movie.Certification.Should().BeNullOrEmpty();
            mostPWCMovie.Movie.CountryCode.Should().BeNullOrEmpty();

            mostPWCMovie.Title.Should().Be("Star Wars: The Force Awakens");
            mostPWCMovie.Year.Should().Be(2015);
            mostPWCMovie.Ids.Should().NotBeNull();
            mostPWCMovie.Ids.Trakt.Should().Be(94024U);
            mostPWCMovie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            mostPWCMovie.Ids.Imdb.Should().Be("tt2488496");
            mostPWCMovie.Ids.Tmdb.Should().Be(140607U);
            mostPWCMovie.Tagline.Should().BeNullOrEmpty();
            mostPWCMovie.Overview.Should().BeNullOrEmpty();
            mostPWCMovie.Released.Should().NotHaveValue();
            mostPWCMovie.Runtime.Should().NotHaveValue();
            mostPWCMovie.UpdatedAt.Should().NotHaveValue();
            mostPWCMovie.Trailer.Should().BeNullOrEmpty();
            mostPWCMovie.Homepage.Should().BeNullOrEmpty();
            mostPWCMovie.Rating.Should().NotHaveValue();
            mostPWCMovie.Votes.Should().NotHaveValue();
            mostPWCMovie.LanguageCode.Should().BeNullOrEmpty();
            mostPWCMovie.AvailableTranslationLanguageCodes.Should().BeNull();
            mostPWCMovie.Genres.Should().BeNull();
            mostPWCMovie.Certification.Should().BeNullOrEmpty();
            mostPWCMovie.CountryCode.Should().BeNullOrEmpty();
        }
コード例 #5
0
        public async Task Test_TraktMostPWCMovie_From_Full_Json()
        {
            var jsonReader   = new MostPWCMovieObjectJsonReader();
            var mostPWCMovie = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktMostPWCMovie;

            mostPWCMovie.Should().NotBeNull();
            mostPWCMovie.WatcherCount.Should().Be(4992);
            mostPWCMovie.PlayCount.Should().Be(7100);
            mostPWCMovie.CollectedCount.Should().Be(1348);

            mostPWCMovie.Movie.Should().NotBeNull();
            mostPWCMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            mostPWCMovie.Movie.Year.Should().Be(2015);
            mostPWCMovie.Movie.Ids.Should().NotBeNull();
            mostPWCMovie.Movie.Ids.Trakt.Should().Be(94024U);
            mostPWCMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            mostPWCMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
            mostPWCMovie.Movie.Ids.Tmdb.Should().Be(140607U);
            mostPWCMovie.Movie.Tagline.Should().Be("Every generation has a story.");
            mostPWCMovie.Movie.Overview.Should().Be("Thirty years after defeating the Galactic Empire, Han Solo and his allies face a new threat from the evil Kylo Ren and his army of Stormtroopers.");
            mostPWCMovie.Movie.Released.Should().Be(DateTime.Parse("2015-12-18"));
            mostPWCMovie.Movie.Runtime.Should().Be(136);
            mostPWCMovie.Movie.UpdatedAt.Should().Be(DateTime.Parse("2016-03-31T09:01:59Z").ToUniversalTime());
            mostPWCMovie.Movie.Trailer.Should().Be("http://youtube.com/watch?v=uwa7N0ShN2U");
            mostPWCMovie.Movie.Homepage.Should().Be("http://www.starwars.com/films/star-wars-episode-vii");
            mostPWCMovie.Movie.Rating.Should().Be(8.31988f);
            mostPWCMovie.Movie.Votes.Should().Be(9338);
            mostPWCMovie.Movie.LanguageCode.Should().Be("en");
            mostPWCMovie.Movie.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "de", "en", "it");
            mostPWCMovie.Movie.Genres.Should().NotBeNull().And.HaveCount(4).And.Contain("action", "adventure", "fantasy", "science-fiction");
            mostPWCMovie.Movie.Certification.Should().Be("PG-13");
            mostPWCMovie.Movie.CountryCode.Should().Be("us");

            mostPWCMovie.Title.Should().Be("Star Wars: The Force Awakens");
            mostPWCMovie.Year.Should().Be(2015);
            mostPWCMovie.Ids.Should().NotBeNull();
            mostPWCMovie.Ids.Trakt.Should().Be(94024U);
            mostPWCMovie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            mostPWCMovie.Ids.Imdb.Should().Be("tt2488496");
            mostPWCMovie.Ids.Tmdb.Should().Be(140607U);
            mostPWCMovie.Tagline.Should().Be("Every generation has a story.");
            mostPWCMovie.Overview.Should().Be("Thirty years after defeating the Galactic Empire, Han Solo and his allies face a new threat from the evil Kylo Ren and his army of Stormtroopers.");
            mostPWCMovie.Released.Should().Be(DateTime.Parse("2015-12-18"));
            mostPWCMovie.Runtime.Should().Be(136);
            mostPWCMovie.UpdatedAt.Should().Be(DateTime.Parse("2016-03-31T09:01:59Z").ToUniversalTime());
            mostPWCMovie.Trailer.Should().Be("http://youtube.com/watch?v=uwa7N0ShN2U");
            mostPWCMovie.Homepage.Should().Be("http://www.starwars.com/films/star-wars-episode-vii");
            mostPWCMovie.Rating.Should().Be(8.31988f);
            mostPWCMovie.Votes.Should().Be(9338);
            mostPWCMovie.LanguageCode.Should().Be("en");
            mostPWCMovie.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "de", "en", "it");
            mostPWCMovie.Genres.Should().NotBeNull().And.HaveCount(4).And.Contain("action", "adventure", "fantasy", "science-fiction");
            mostPWCMovie.Certification.Should().Be("PG-13");
            mostPWCMovie.CountryCode.Should().Be("us");
        }
コード例 #6
0
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new MostPWCMovieObjectJsonReader();

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

                traktMostPWCMovie.Should().BeNull();
            }
        }
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new MostPWCMovieObjectJsonReader();

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

                    traktMostPWCMovie.Should().BeNull();
                }
        }
コード例 #8
0
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_Json_String_Not_Valid_5()
        {
            var jsonReader = new MostPWCMovieObjectJsonReader();

            var traktMostPWCMovie = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_5);

            traktMostPWCMovie.Should().NotBeNull();
            traktMostPWCMovie.WatcherCount.Should().BeNull();
            traktMostPWCMovie.PlayCount.Should().BeNull();
            traktMostPWCMovie.CollectedCount.Should().BeNull();
            traktMostPWCMovie.Movie.Should().BeNull();
        }
コード例 #9
0
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_Json_String_Incomplete_4()
        {
            var jsonReader = new MostPWCMovieObjectJsonReader();

            var traktMostPWCMovie = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_4);

            traktMostPWCMovie.Should().NotBeNull();
            traktMostPWCMovie.WatcherCount.Should().Be(4992);
            traktMostPWCMovie.PlayCount.Should().Be(7100);
            traktMostPWCMovie.CollectedCount.Should().Be(1348);
            traktMostPWCMovie.Movie.Should().BeNull();
        }
コード例 #10
0
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_Stream_Incomplete_7()
        {
            var traktJsonReader = new MostPWCMovieObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_7.ToStream())
            {
                var traktMostPWCMovie = await traktJsonReader.ReadObjectAsync(stream);

                traktMostPWCMovie.Should().NotBeNull();
                traktMostPWCMovie.WatcherCount.Should().BeNull();
                traktMostPWCMovie.PlayCount.Should().BeNull();
                traktMostPWCMovie.CollectedCount.Should().Be(1348);
                traktMostPWCMovie.Movie.Should().BeNull();
            }
        }
コード例 #11
0
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_Stream_Not_Valid_5()
        {
            var traktJsonReader = new MostPWCMovieObjectJsonReader();

            using (var stream = JSON_NOT_VALID_5.ToStream())
            {
                var traktMostPWCMovie = await traktJsonReader.ReadObjectAsync(stream);

                traktMostPWCMovie.Should().NotBeNull();
                traktMostPWCMovie.WatcherCount.Should().BeNull();
                traktMostPWCMovie.PlayCount.Should().BeNull();
                traktMostPWCMovie.CollectedCount.Should().BeNull();
                traktMostPWCMovie.Movie.Should().BeNull();
            }
        }
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_5()
        {
            var traktJsonReader = new MostPWCMovieObjectJsonReader();

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

                    traktMostPWCMovie.Should().NotBeNull();
                    traktMostPWCMovie.WatcherCount.Should().BeNull();
                    traktMostPWCMovie.PlayCount.Should().BeNull();
                    traktMostPWCMovie.CollectedCount.Should().BeNull();
                    traktMostPWCMovie.Movie.Should().BeNull();
                }
        }
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_JsonReader_Incomplete_7()
        {
            var traktJsonReader = new MostPWCMovieObjectJsonReader();

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

                    traktMostPWCMovie.Should().NotBeNull();
                    traktMostPWCMovie.WatcherCount.Should().BeNull();
                    traktMostPWCMovie.PlayCount.Should().BeNull();
                    traktMostPWCMovie.CollectedCount.Should().Be(1348);
                    traktMostPWCMovie.Movie.Should().BeNull();
                }
        }
コード例 #14
0
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_Json_String_Incomplete_3()
        {
            var jsonReader = new MostPWCMovieObjectJsonReader();

            var traktMostPWCMovie = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_3);

            traktMostPWCMovie.Should().NotBeNull();
            traktMostPWCMovie.WatcherCount.Should().Be(4992);
            traktMostPWCMovie.PlayCount.Should().Be(7100);
            traktMostPWCMovie.CollectedCount.Should().BeNull();
            traktMostPWCMovie.Movie.Should().NotBeNull();
            traktMostPWCMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            traktMostPWCMovie.Movie.Year.Should().Be(2015);
            traktMostPWCMovie.Movie.Ids.Should().NotBeNull();
            traktMostPWCMovie.Movie.Ids.Trakt.Should().Be(94024U);
            traktMostPWCMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            traktMostPWCMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
            traktMostPWCMovie.Movie.Ids.Tmdb.Should().Be(140607U);
        }
コード例 #15
0
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new MostPWCMovieObjectJsonReader();

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

                traktMostPWCMovie.Should().NotBeNull();
                traktMostPWCMovie.WatcherCount.Should().Be(4992);
                traktMostPWCMovie.PlayCount.Should().Be(7100);
                traktMostPWCMovie.CollectedCount.Should().BeNull();
                traktMostPWCMovie.Movie.Should().NotBeNull();
                traktMostPWCMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                traktMostPWCMovie.Movie.Year.Should().Be(2015);
                traktMostPWCMovie.Movie.Ids.Should().NotBeNull();
                traktMostPWCMovie.Movie.Ids.Trakt.Should().Be(94024U);
                traktMostPWCMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                traktMostPWCMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
                traktMostPWCMovie.Movie.Ids.Tmdb.Should().Be(140607U);
            }
        }
        public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new MostPWCMovieObjectJsonReader();

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

                    traktMostPWCMovie.Should().NotBeNull();
                    traktMostPWCMovie.WatcherCount.Should().Be(4992);
                    traktMostPWCMovie.PlayCount.Should().Be(7100);
                    traktMostPWCMovie.CollectedCount.Should().Be(1348);
                    traktMostPWCMovie.Movie.Should().NotBeNull();
                    traktMostPWCMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                    traktMostPWCMovie.Movie.Year.Should().Be(2015);
                    traktMostPWCMovie.Movie.Ids.Should().NotBeNull();
                    traktMostPWCMovie.Movie.Ids.Trakt.Should().Be(94024U);
                    traktMostPWCMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                    traktMostPWCMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
                    traktMostPWCMovie.Movie.Ids.Tmdb.Should().Be(140607U);
                }
        }
 public async Task Test_MostPWCMovieObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new MostPWCMovieObjectJsonReader();
     Func <Task <ITraktMostPWCMovie> > traktMostPWCMovie = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktMostPWCMovie.Should().ThrowAsync <ArgumentNullException>();
 }