public void Test_CalendarMovieObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new CalendarMovieObjectJsonReader();
            Func <Task <ITraktCalendarMovie> > traktCalendarMovie = () => jsonReader.ReadObjectAsync(default(string));

            traktCalendarMovie.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 2
0
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new CalendarMovieObjectJsonReader();

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

            traktCalendarMovie.Should().BeNull();
        }
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new CalendarMovieObjectJsonReader();

            var traktCalendarMovie = await jsonReader.ReadObjectAsync(default(Stream));

            traktCalendarMovie.Should().BeNull();
        }
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new CalendarMovieObjectJsonReader();

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

            traktCalendarMovie.Should().BeNull();
        }
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new CalendarMovieObjectJsonReader();

            var traktCalendarMovie = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktCalendarMovie.Should().NotBeNull();
            traktCalendarMovie.CalendarRelease.Should().BeNull();
            traktCalendarMovie.Movie.Should().BeNull();
        }
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new CalendarMovieObjectJsonReader();

            var traktCalendarMovie = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            traktCalendarMovie.Should().NotBeNull();
            traktCalendarMovie.CalendarRelease.Should().Be(DateTime.Parse("2014-08-01"));
            traktCalendarMovie.Movie.Should().BeNull();
        }
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_Json_String_Incomplete_1()
        {
            var jsonReader = new CalendarMovieObjectJsonReader();

            var traktCalendarMovie = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_1);

            traktCalendarMovie.Should().NotBeNull();
            traktCalendarMovie.CalendarRelease.Should().Be(DateTime.Parse("2014-08-01"));
            traktCalendarMovie.Movie.Should().BeNull();
        }
Ejemplo n.º 8
0
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new CalendarMovieObjectJsonReader();

            using (var stream = string.Empty.ToStream())
            {
                var traktCalendarMovie = await jsonReader.ReadObjectAsync(stream);

                traktCalendarMovie.Should().BeNull();
            }
        }
Ejemplo n.º 9
0
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new CalendarMovieObjectJsonReader();

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

                    traktCalendarMovie.Should().BeNull();
                }
        }
Ejemplo n.º 10
0
        public async Task Test_TraktCalendarMovie_From_Full_Json()
        {
            var jsonReader    = new CalendarMovieObjectJsonReader();
            var calendarMovie = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktCalendarMovie;

            calendarMovie.Should().NotBeNull();
            calendarMovie.CalendarRelease.Should().Be(DateTime.Parse("2014-08-01"));

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

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

            calendarMovie.Should().NotBeNull();
            calendarMovie.CalendarRelease.Should().Be(DateTime.Parse("2014-08-01"));

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

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

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var traktCalendarMovie = await jsonReader.ReadObjectAsync(stream);

                traktCalendarMovie.Should().NotBeNull();
                traktCalendarMovie.CalendarRelease.Should().BeNull();
                traktCalendarMovie.Movie.Should().BeNull();
            }
        }
Ejemplo n.º 13
0
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new CalendarMovieObjectJsonReader();

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

                    traktCalendarMovie.Should().NotBeNull();
                    traktCalendarMovie.CalendarRelease.Should().Be(DateTime.Parse("2014-08-01"));
                    traktCalendarMovie.Movie.Should().BeNull();
                }
        }
Ejemplo n.º 14
0
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new CalendarMovieObjectJsonReader();

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

                    traktCalendarMovie.Should().NotBeNull();
                    traktCalendarMovie.CalendarRelease.Should().BeNull();
                    traktCalendarMovie.Movie.Should().BeNull();
                }
        }
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new CalendarMovieObjectJsonReader();

            var traktCalendarMovie = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

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

            var traktCalendarMovie = await jsonReader.ReadObjectAsync(JSON_COMPLETE);

            traktCalendarMovie.Should().NotBeNull();
            traktCalendarMovie.CalendarRelease.Should().Be(DateTime.Parse("2014-08-01"));
            traktCalendarMovie.Movie.Should().NotBeNull();
            traktCalendarMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            traktCalendarMovie.Movie.Year.Should().Be(2015);
            traktCalendarMovie.Movie.Ids.Should().NotBeNull();
            traktCalendarMovie.Movie.Ids.Trakt.Should().Be(94024U);
            traktCalendarMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            traktCalendarMovie.Movie.Ids.Imdb.Should().Be("tt2488496");
            traktCalendarMovie.Movie.Ids.Tmdb.Should().Be(140607U);
        }
Ejemplo n.º 17
0
        public async Task Test_CalendarMovieObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new CalendarMovieObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_2.ToStream())
            {
                var traktCalendarMovie = await jsonReader.ReadObjectAsync(stream);

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