Ejemplo n.º 1
0
        public void Test_TrendingMovieObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();
            Func <Task <ITraktTrendingMovie> > traktTrendingMovie = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktTrendingMovie.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new TrendingMovieObjectJsonReader();

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

            traktTrendingMovie.Should().BeNull();
        }
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();

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

            traktTrendingMovie.Should().BeNull();
        }
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new TrendingMovieObjectJsonReader();

            var traktTrendingMovie = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktTrendingMovie.Should().NotBeNull();
            traktTrendingMovie.Watchers.Should().BeNull();
            traktTrendingMovie.Movie.Should().BeNull();
        }
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_Json_String_Incomplete_1()
        {
            var jsonReader = new TrendingMovieObjectJsonReader();

            var traktTrendingMovie = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_1);

            traktTrendingMovie.Should().NotBeNull();
            traktTrendingMovie.Watchers.Should().Be(35);
            traktTrendingMovie.Movie.Should().BeNull();
        }
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();

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

                traktTrendingMovie.Should().BeNull();
            }
        }
Ejemplo n.º 7
0
        public async Task Test_TraktTrendingMovie_From_Full_Json()
        {
            var jsonReader    = new TrendingMovieObjectJsonReader();
            var trendingMovie = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktTrendingMovie;

            trendingMovie.Should().NotBeNull();
            trendingMovie.Watchers.Should().Be(35);

            trendingMovie.Movie.Should().NotBeNull();
            trendingMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            trendingMovie.Movie.Year.Should().Be(2015);
            trendingMovie.Movie.Ids.Should().NotBeNull();
            trendingMovie.Movie.Ids.Trakt.Should().Be(94024U);
            trendingMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            trendingMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
            trendingMovie.Movie.Ids.Tmdb.Should().Be(140607U);
            trendingMovie.Movie.Tagline.Should().Be("Every generation has a story.");
            trendingMovie.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.");
            trendingMovie.Movie.Released.Should().Be(DateTime.Parse("2015-12-18"));
            trendingMovie.Movie.Runtime.Should().Be(136);
            trendingMovie.Movie.UpdatedAt.Should().Be(DateTime.Parse("2016-03-31T09:01:59Z").ToUniversalTime());
            trendingMovie.Movie.Trailer.Should().Be("http://youtube.com/watch?v=uwa7N0ShN2U");
            trendingMovie.Movie.Homepage.Should().Be("http://www.starwars.com/films/star-wars-episode-vii");
            trendingMovie.Movie.Rating.Should().Be(8.31988f);
            trendingMovie.Movie.Votes.Should().Be(9338);
            trendingMovie.Movie.LanguageCode.Should().Be("en");
            trendingMovie.Movie.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "de", "en", "it");
            trendingMovie.Movie.Genres.Should().NotBeNull().And.HaveCount(4).And.Contain("action", "adventure", "fantasy", "science-fiction");
            trendingMovie.Movie.Certification.Should().Be("PG-13");
            trendingMovie.Movie.CountryCode.Should().Be("us");

            trendingMovie.Title.Should().Be("Star Wars: The Force Awakens");
            trendingMovie.Year.Should().Be(2015);
            trendingMovie.Ids.Should().NotBeNull();
            trendingMovie.Ids.Trakt.Should().Be(94024U);
            trendingMovie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            trendingMovie.Ids.Imdb.Should().Be("tt2488496");
            trendingMovie.Ids.Tmdb.Should().Be(140607U);
            trendingMovie.Tagline.Should().Be("Every generation has a story.");
            trendingMovie.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.");
            trendingMovie.Released.Should().Be(DateTime.Parse("2015-12-18"));
            trendingMovie.Runtime.Should().Be(136);
            trendingMovie.UpdatedAt.Should().Be(DateTime.Parse("2016-03-31T09:01:59Z").ToUniversalTime());
            trendingMovie.Trailer.Should().Be("http://youtube.com/watch?v=uwa7N0ShN2U");
            trendingMovie.Homepage.Should().Be("http://www.starwars.com/films/star-wars-episode-vii");
            trendingMovie.Rating.Should().Be(8.31988f);
            trendingMovie.Votes.Should().Be(9338);
            trendingMovie.LanguageCode.Should().Be("en");
            trendingMovie.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "de", "en", "it");
            trendingMovie.Genres.Should().NotBeNull().And.HaveCount(4).And.Contain("action", "adventure", "fantasy", "science-fiction");
            trendingMovie.Certification.Should().Be("PG-13");
            trendingMovie.CountryCode.Should().Be("us");
        }
Ejemplo n.º 8
0
        public async Task Test_TraktTrendingMovie_From_Minimal_Json()
        {
            var jsonReader    = new TrendingMovieObjectJsonReader();
            var trendingMovie = await jsonReader.ReadObjectAsync(MINIMAL_JSON) as TraktTrendingMovie;

            trendingMovie.Should().NotBeNull();
            trendingMovie.Watchers.Should().Be(35);

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

            trendingMovie.Title.Should().Be("Star Wars: The Force Awakens");
            trendingMovie.Year.Should().Be(2015);
            trendingMovie.Ids.Should().NotBeNull();
            trendingMovie.Ids.Trakt.Should().Be(94024U);
            trendingMovie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            trendingMovie.Ids.Imdb.Should().Be("tt2488496");
            trendingMovie.Ids.Tmdb.Should().Be(140607U);
            trendingMovie.Tagline.Should().BeNullOrEmpty();
            trendingMovie.Overview.Should().BeNullOrEmpty();
            trendingMovie.Released.Should().NotHaveValue();
            trendingMovie.Runtime.Should().NotHaveValue();
            trendingMovie.UpdatedAt.Should().NotHaveValue();
            trendingMovie.Trailer.Should().BeNullOrEmpty();
            trendingMovie.Homepage.Should().BeNullOrEmpty();
            trendingMovie.Rating.Should().NotHaveValue();
            trendingMovie.Votes.Should().NotHaveValue();
            trendingMovie.LanguageCode.Should().BeNullOrEmpty();
            trendingMovie.AvailableTranslationLanguageCodes.Should().BeNull();
            trendingMovie.Genres.Should().BeNull();
            trendingMovie.Certification.Should().BeNullOrEmpty();
            trendingMovie.CountryCode.Should().BeNullOrEmpty();
        }
Ejemplo n.º 9
0
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();

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

                    traktTrendingMovie.Should().BeNull();
                }
        }
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktTrendingMovie = await traktJsonReader.ReadObjectAsync(stream);

                traktTrendingMovie.Should().NotBeNull();
                traktTrendingMovie.Watchers.Should().Be(35);
                traktTrendingMovie.Movie.Should().BeNull();
            }
        }
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_Stream_Incomplete_1()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();

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

                traktTrendingMovie.Should().NotBeNull();
                traktTrendingMovie.Watchers.Should().Be(35);
                traktTrendingMovie.Movie.Should().BeNull();
            }
        }
Ejemplo n.º 12
0
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();

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

                    traktTrendingMovie.Should().NotBeNull();
                    traktTrendingMovie.Watchers.Should().BeNull();
                    traktTrendingMovie.Movie.Should().BeNull();
                }
        }
Ejemplo n.º 13
0
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();

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

                    traktTrendingMovie.Should().NotBeNull();
                    traktTrendingMovie.Watchers.Should().Be(35);
                    traktTrendingMovie.Movie.Should().BeNull();
                }
        }
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new TrendingMovieObjectJsonReader();

            var traktTrendingMovie = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

            traktTrendingMovie.Should().NotBeNull();
            traktTrendingMovie.Watchers.Should().BeNull();
            traktTrendingMovie.Movie.Should().NotBeNull();
            traktTrendingMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            traktTrendingMovie.Movie.Year.Should().Be(2015);
            traktTrendingMovie.Movie.Ids.Should().NotBeNull();
            traktTrendingMovie.Movie.Ids.Trakt.Should().Be(94024U);
            traktTrendingMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            traktTrendingMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
            traktTrendingMovie.Movie.Ids.Tmdb.Should().Be(140607U);
        }
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();

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

                traktTrendingMovie.Should().NotBeNull();
                traktTrendingMovie.Watchers.Should().BeNull();
                traktTrendingMovie.Movie.Should().NotBeNull();
                traktTrendingMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                traktTrendingMovie.Movie.Year.Should().Be(2015);
                traktTrendingMovie.Movie.Ids.Should().NotBeNull();
                traktTrendingMovie.Movie.Ids.Trakt.Should().Be(94024U);
                traktTrendingMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                traktTrendingMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
                traktTrendingMovie.Movie.Ids.Tmdb.Should().Be(140607U);
            }
        }
Ejemplo n.º 16
0
        public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new TrendingMovieObjectJsonReader();

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

                    traktTrendingMovie.Should().NotBeNull();
                    traktTrendingMovie.Watchers.Should().Be(35);
                    traktTrendingMovie.Movie.Should().NotBeNull();
                    traktTrendingMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                    traktTrendingMovie.Movie.Year.Should().Be(2015);
                    traktTrendingMovie.Movie.Ids.Should().NotBeNull();
                    traktTrendingMovie.Movie.Ids.Trakt.Should().Be(94024U);
                    traktTrendingMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                    traktTrendingMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
                    traktTrendingMovie.Movie.Ids.Tmdb.Should().Be(140607U);
                }
        }
Ejemplo n.º 17
0
 public async Task Test_TrendingMovieObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new TrendingMovieObjectJsonReader();
     Func <Task <ITraktTrendingMovie> > traktTrendingMovie = () => jsonReader.ReadObjectAsync(default(string));
     await traktTrendingMovie.Should().ThrowAsync <ArgumentNullException>();
 }