Example #1
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_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();
                }
        }
        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);
        }
Example #5
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>();
 }