public async Task Test_TraktPersonMovieCreditsCastItem_From_Json()
        {
            var jsonReader      = new PersonMovieCreditsCastItemObjectJsonReader();
            var creditsCastItem = await jsonReader.ReadObjectAsync(JSON) as TraktPersonMovieCreditsCastItem;

            creditsCastItem.Should().NotBeNull();
            creditsCastItem.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
            creditsCastItem.Movie.Should().NotBeNull();
            creditsCastItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            creditsCastItem.Movie.Year.Should().Be(2015);
            creditsCastItem.Movie.Ids.Should().NotBeNull();
            creditsCastItem.Movie.Ids.Trakt.Should().Be(94024U);
            creditsCastItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            creditsCastItem.Movie.Ids.Imdb.Should().Be("tt2488496");
            creditsCastItem.Movie.Ids.Tmdb.Should().Be(140607U);
            creditsCastItem.Movie.Tagline.Should().BeNullOrEmpty();
            creditsCastItem.Movie.Overview.Should().BeNullOrEmpty();
            creditsCastItem.Movie.Released.Should().NotHaveValue();
            creditsCastItem.Movie.Runtime.Should().NotHaveValue();
            creditsCastItem.Movie.UpdatedAt.Should().NotHaveValue();
            creditsCastItem.Movie.Trailer.Should().BeNullOrEmpty();
            creditsCastItem.Movie.Homepage.Should().BeNullOrEmpty();
            creditsCastItem.Movie.Rating.Should().NotHaveValue();
            creditsCastItem.Movie.Votes.Should().NotHaveValue();
            creditsCastItem.Movie.LanguageCode.Should().BeNullOrEmpty();
            creditsCastItem.Movie.AvailableTranslationLanguageCodes.Should().BeNull();
            creditsCastItem.Movie.Genres.Should().BeNull();
            creditsCastItem.Movie.Certification.Should().BeNullOrEmpty();
        }
        public void Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();
            Func <Task <ITraktPersonMovieCreditsCastItem> > movieCreditsCastItem = () => jsonReader.ReadObjectAsync(default(string));

            movieCreditsCastItem.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_TraktPersonMovieCreditsCastItem_From_Full_Json()
        {
            var jsonReader      = new PersonMovieCreditsCastItemObjectJsonReader();
            var creditsCastItem = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktPersonMovieCreditsCastItem;

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

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

            movieCreditsCastItem.Should().BeNull();
        }
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

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

            movieCreditsCastItem.Should().BeNull();
        }
示例#6
0
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

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

            movieCreditsCastItem.Should().BeNull();
        }
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

            var movieCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            movieCreditsCastItem.Should().NotBeNull();
            movieCreditsCastItem.Characters.Should().BeNull();
            movieCreditsCastItem.Movie.Should().BeNull();
        }
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

            var movieCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            movieCreditsCastItem.Should().NotBeNull();
            movieCreditsCastItem.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
            movieCreditsCastItem.Movie.Should().BeNull();
        }
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

            var movieCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            movieCreditsCastItem.Should().NotBeNull();
            movieCreditsCastItem.Character.Should().Be("Joe Brody");
            movieCreditsCastItem.Movie.Should().BeNull();
        }
示例#10
0
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

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

                movieCreditsCastItem.Should().BeNull();
            }
        }
示例#11
0
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

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

                    movieCreditsCastItem.Should().BeNull();
                }
        }
示例#12
0
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var movieCreditsCastItem = await jsonReader.ReadObjectAsync(stream);

                movieCreditsCastItem.Should().NotBeNull();
                movieCreditsCastItem.Character.Should().Be("Joe Brody");
                movieCreditsCastItem.Movie.Should().BeNull();
            }
        }
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

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

                movieCreditsCastItem.Should().NotBeNull();
                movieCreditsCastItem.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
                movieCreditsCastItem.Movie.Should().BeNull();
            }
        }
示例#14
0
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

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

                    movieCreditsCastItem.Should().NotBeNull();
                    movieCreditsCastItem.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
                    movieCreditsCastItem.Movie.Should().BeNull();
                }
        }
示例#15
0
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

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

                    movieCreditsCastItem.Should().NotBeNull();
                    movieCreditsCastItem.Characters.Should().BeNull();
                    movieCreditsCastItem.Movie.Should().BeNull();
                }
        }
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

            var movieCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

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

            var movieCreditsCastItem = await jsonReader.ReadObjectAsync(JSON_COMPLETE);

            movieCreditsCastItem.Should().NotBeNull();
            movieCreditsCastItem.Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody");
            movieCreditsCastItem.Movie.Should().NotBeNull();
            movieCreditsCastItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            movieCreditsCastItem.Movie.Year.Should().Be(2015);
            movieCreditsCastItem.Movie.Ids.Should().NotBeNull();
            movieCreditsCastItem.Movie.Ids.Trakt.Should().Be(94024U);
            movieCreditsCastItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            movieCreditsCastItem.Movie.Ids.Imdb.Should().Be("tt2488496");
            movieCreditsCastItem.Movie.Ids.Tmdb.Should().Be(140607U);
        }
示例#18
0
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_Stream_Incomplete_1()
        {
            var jsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_1.ToStream())
            {
                var movieCreditsCastItem = await jsonReader.ReadObjectAsync(stream);

                movieCreditsCastItem.Should().NotBeNull();
                movieCreditsCastItem.Character.Should().BeNull();
                movieCreditsCastItem.Movie.Should().NotBeNull();
                movieCreditsCastItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                movieCreditsCastItem.Movie.Year.Should().Be(2015);
                movieCreditsCastItem.Movie.Ids.Should().NotBeNull();
                movieCreditsCastItem.Movie.Ids.Trakt.Should().Be(94024U);
                movieCreditsCastItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                movieCreditsCastItem.Movie.Ids.Imdb.Should().Be("tt2488496");
                movieCreditsCastItem.Movie.Ids.Tmdb.Should().Be(140607U);
            }
        }
示例#19
0
        public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new PersonMovieCreditsCastItemObjectJsonReader();

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

                    movieCreditsCastItem.Should().NotBeNull();
                    movieCreditsCastItem.Character.Should().Be("Joe Brody");
                    movieCreditsCastItem.Movie.Should().NotBeNull();
                    movieCreditsCastItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                    movieCreditsCastItem.Movie.Year.Should().Be(2015);
                    movieCreditsCastItem.Movie.Ids.Should().NotBeNull();
                    movieCreditsCastItem.Movie.Ids.Trakt.Should().Be(94024U);
                    movieCreditsCastItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                    movieCreditsCastItem.Movie.Ids.Imdb.Should().Be("tt2488496");
                    movieCreditsCastItem.Movie.Ids.Tmdb.Should().Be(140607U);
                }
        }
 public async Task Test_PersonMovieCreditsCastItemObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new PersonMovieCreditsCastItemObjectJsonReader();
     Func <Task <ITraktPersonMovieCreditsCastItem> > movieCreditsCastItem = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await movieCreditsCastItem.Should().ThrowAsync <ArgumentNullException>();
 }