示例#1
0
        public void Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();
            Func <Task <ITraktPersonMovieCreditsCrewItem> > movieCreditsCrewItem = () => jsonReader.ReadObjectAsync(default(string));

            movieCreditsCrewItem.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_TraktPersonMovieCreditsCrewItem_From_Full_Json()
        {
            var jsonReader      = new PersonMovieCreditsCrewItemObjectJsonReader();
            var creditsCrewItem = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktPersonMovieCreditsCrewItem;

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

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

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

            movieCreditsCrewItem.Should().BeNull();
        }
示例#5
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

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

            movieCreditsCrewItem.Should().BeNull();
        }
示例#6
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

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

            movieCreditsCrewItem.Should().BeNull();
        }
示例#7
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

            var movieCreditsCrewItem = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            movieCreditsCrewItem.Should().NotBeNull();
            movieCreditsCrewItem.Job.Should().Be("Director");
            movieCreditsCrewItem.Movie.Should().BeNull();
        }
示例#8
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

            var movieCreditsCrewItem = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            movieCreditsCrewItem.Should().NotBeNull();
            movieCreditsCrewItem.Job.Should().BeNull();
            movieCreditsCrewItem.Movie.Should().BeNull();
        }
示例#9
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

            var movieCreditsCrewItem = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            movieCreditsCrewItem.Should().NotBeNull();
            movieCreditsCrewItem.Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Director");
            movieCreditsCrewItem.Movie.Should().BeNull();
        }
示例#10
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

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

                movieCreditsCrewItem.Should().BeNull();
            }
        }
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

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

                    movieCreditsCrewItem.Should().BeNull();
                }
        }
示例#12
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

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

                movieCreditsCrewItem.Should().NotBeNull();
                movieCreditsCrewItem.Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Director");
                movieCreditsCrewItem.Movie.Should().BeNull();
            }
        }
示例#13
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

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

                movieCreditsCrewItem.Should().NotBeNull();
                movieCreditsCrewItem.Jobs.Should().BeNull();
                movieCreditsCrewItem.Movie.Should().BeNull();
            }
        }
示例#14
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

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

                    movieCreditsCrewItem.Should().NotBeNull();
                    movieCreditsCrewItem.Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Director");
                    movieCreditsCrewItem.Movie.Should().BeNull();
                }
        }
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_2()
        {
            var traktJsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

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

                    movieCreditsCrewItem.Should().NotBeNull();
                    movieCreditsCrewItem.Job.Should().Be("Director");
                    movieCreditsCrewItem.Movie.Should().BeNull();
                }
        }
示例#16
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

            var movieCreditsCrewItem = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

            movieCreditsCrewItem.Should().NotBeNull();
            movieCreditsCrewItem.Job.Should().BeNull();
            movieCreditsCrewItem.Movie.Should().NotBeNull();
            movieCreditsCrewItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            movieCreditsCrewItem.Movie.Year.Should().Be(2015);
            movieCreditsCrewItem.Movie.Ids.Should().NotBeNull();
            movieCreditsCrewItem.Movie.Ids.Trakt.Should().Be(94024U);
            movieCreditsCrewItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            movieCreditsCrewItem.Movie.Ids.Imdb.Should().Be("tt2488496");
            movieCreditsCrewItem.Movie.Ids.Tmdb.Should().Be(140607U);
        }
示例#17
0
        public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Json_String_Complete()
        {
            var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();

            var movieCreditsCrewItem = await jsonReader.ReadObjectAsync(JSON_COMPLETE);

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

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

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

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

                    movieCreditsCrewItem.Should().NotBeNull();
                    movieCreditsCrewItem.Job.Should().Be("Director");
                    movieCreditsCrewItem.Movie.Should().NotBeNull();
                    movieCreditsCrewItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                    movieCreditsCrewItem.Movie.Year.Should().Be(2015);
                    movieCreditsCrewItem.Movie.Ids.Should().NotBeNull();
                    movieCreditsCrewItem.Movie.Ids.Trakt.Should().Be(94024U);
                    movieCreditsCrewItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                    movieCreditsCrewItem.Movie.Ids.Imdb.Should().Be("tt2488496");
                    movieCreditsCrewItem.Movie.Ids.Tmdb.Should().Be(140607U);
                }
        }
示例#20
0
 public async Task Test_PersonMovieCreditsCrewItemObjectJsonReader_ReadObject_From_Stream_Null()
 {
     var jsonReader = new PersonMovieCreditsCrewItemObjectJsonReader();
     Func <Task <ITraktPersonMovieCreditsCrewItem> > movieCreditsCrewItem = () => jsonReader.ReadObjectAsync(default(Stream));
     await movieCreditsCrewItem.Should().ThrowAsync <ArgumentNullException>();
 }