Exemplo n.º 1
0
        public void Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new BoxOfficeMovieObjectJsonReader();
            Func <Task <ITraktBoxOfficeMovie> > traktBoxOfficeMovie = () => jsonReader.ReadObjectAsync(default(string));

            traktBoxOfficeMovie.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new BoxOfficeMovieObjectJsonReader();

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

            traktBoxOfficeMovie.Should().BeNull();
        }
Exemplo n.º 3
0
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new BoxOfficeMovieObjectJsonReader();

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

            traktBoxOfficeMovie.Should().BeNull();
        }
Exemplo n.º 4
0
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_Json_String_Incomplete_1()
        {
            var jsonReader = new BoxOfficeMovieObjectJsonReader();

            var traktBoxOfficeMovie = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_1);

            traktBoxOfficeMovie.Should().NotBeNull();
            traktBoxOfficeMovie.Revenue.Should().Be(166007347);
            traktBoxOfficeMovie.Movie.Should().BeNull();
        }
Exemplo n.º 5
0
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new BoxOfficeMovieObjectJsonReader();

            var traktBoxOfficeMovie = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktBoxOfficeMovie.Should().NotBeNull();
            traktBoxOfficeMovie.Revenue.Should().BeNull();
            traktBoxOfficeMovie.Movie.Should().BeNull();
        }
Exemplo n.º 6
0
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new BoxOfficeMovieObjectJsonReader();

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

                traktBoxOfficeMovie.Should().BeNull();
            }
        }
        public async Task Test_TraktBoxOfficeMovie_From_Minimal_Json()
        {
            var jsonReader     = new BoxOfficeMovieObjectJsonReader();
            var boxOfficeMovie = await jsonReader.ReadObjectAsync(MINIMAL_JSON) as TraktBoxOfficeMovie;

            boxOfficeMovie.Should().NotBeNull();
            boxOfficeMovie.Revenue.Should().Be(166007347);

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

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

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

                    traktBoxOfficeMovie.Should().BeNull();
                }
        }
        public async Task Test_TraktBoxOfficeMovie_From_Full_Json()
        {
            var jsonReader     = new BoxOfficeMovieObjectJsonReader();
            var boxOfficeMovie = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktBoxOfficeMovie;

            boxOfficeMovie.Should().NotBeNull();
            boxOfficeMovie.Revenue.Should().Be(166007347);

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

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

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

                traktBoxOfficeMovie.Should().NotBeNull();
                traktBoxOfficeMovie.Revenue.Should().Be(166007347);
                traktBoxOfficeMovie.Movie.Should().BeNull();
            }
        }
Exemplo n.º 11
0
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new BoxOfficeMovieObjectJsonReader();

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

                traktBoxOfficeMovie.Should().NotBeNull();
                traktBoxOfficeMovie.Revenue.Should().Be(166007347);
                traktBoxOfficeMovie.Movie.Should().BeNull();
            }
        }
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new BoxOfficeMovieObjectJsonReader();

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

                    traktBoxOfficeMovie.Should().NotBeNull();
                    traktBoxOfficeMovie.Revenue.Should().Be(166007347);
                    traktBoxOfficeMovie.Movie.Should().BeNull();
                }
        }
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new BoxOfficeMovieObjectJsonReader();

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

                    traktBoxOfficeMovie.Should().NotBeNull();
                    traktBoxOfficeMovie.Revenue.Should().BeNull();
                    traktBoxOfficeMovie.Movie.Should().BeNull();
                }
        }
Exemplo n.º 14
0
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new BoxOfficeMovieObjectJsonReader();

            var traktBoxOfficeMovie = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

            traktBoxOfficeMovie.Should().NotBeNull();
            traktBoxOfficeMovie.Revenue.Should().BeNull();
            traktBoxOfficeMovie.Movie.Should().NotBeNull();
            traktBoxOfficeMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            traktBoxOfficeMovie.Movie.Year.Should().Be(2015);
            traktBoxOfficeMovie.Movie.Ids.Should().NotBeNull();
            traktBoxOfficeMovie.Movie.Ids.Trakt.Should().Be(94024U);
            traktBoxOfficeMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            traktBoxOfficeMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
            traktBoxOfficeMovie.Movie.Ids.Tmdb.Should().Be(140607U);
        }
Exemplo n.º 15
0
        public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var traktJsonReader = new BoxOfficeMovieObjectJsonReader();

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

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

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

                    traktBoxOfficeMovie.Should().NotBeNull();
                    traktBoxOfficeMovie.Revenue.Should().Be(166007347);
                    traktBoxOfficeMovie.Movie.Should().NotBeNull();
                    traktBoxOfficeMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                    traktBoxOfficeMovie.Movie.Year.Should().Be(2015);
                    traktBoxOfficeMovie.Movie.Ids.Should().NotBeNull();
                    traktBoxOfficeMovie.Movie.Ids.Trakt.Should().Be(94024U);
                    traktBoxOfficeMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                    traktBoxOfficeMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
                    traktBoxOfficeMovie.Movie.Ids.Tmdb.Should().Be(140607U);
                }
        }
 public async Task Test_BoxOfficeMovieObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new BoxOfficeMovieObjectJsonReader();
     Func <Task <ITraktBoxOfficeMovie> > traktBoxOfficeMovie = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktBoxOfficeMovie.Should().ThrowAsync <ArgumentNullException>();
 }