public void Test_MovieReleaseObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();
            Func <Task <ITraktMovieRelease> > traktMovieRelease = () => traktJsonReader.ReadObjectAsync(default(Stream));

            traktMovieRelease.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

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

            traktMovieRelease.Should().BeNull();
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new MovieReleaseObjectJsonReader();

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

            traktMovieRelease.Should().BeNull();
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

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

                traktMovieRelease.Should().BeNull();
            }
        }
        public async Task Test_TraktMovieRelease_From_Json()
        {
            var jsonReader   = new MovieReleaseObjectJsonReader();
            var movieRelease = await jsonReader.ReadObjectAsync(JSON) as TraktMovieRelease;

            movieRelease.Should().NotBeNull();
            movieRelease.CountryCode.Should().Be("us");
            movieRelease.Certification.Should().Be("PG-13");
            movieRelease.ReleaseDate.Should().Be(DateTime.Parse("2015-12-14"));
            movieRelease.ReleaseType.Should().Be(TraktReleaseType.Premiere);
            movieRelease.Note.Should().Be("Los Angeles, California");
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

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

                    traktMovieRelease.Should().BeNull();
                }
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Json_String_Not_Valid_4()
        {
            var jsonReader = new MovieReleaseObjectJsonReader();

            var traktMovieRelease = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_4);

            traktMovieRelease.Should().NotBeNull();
            traktMovieRelease.CountryCode.Should().Be("us");
            traktMovieRelease.Certification.Should().Be("PG-13");
            traktMovieRelease.ReleaseDate.Should().Be(DateTime.Parse("2015-12-14"));
            traktMovieRelease.ReleaseType.Should().BeNull();
            traktMovieRelease.Note.Should().Be("Los Angeles, California");
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Json_String_Incomplete_7()
        {
            var jsonReader = new MovieReleaseObjectJsonReader();

            var traktMovieRelease = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_7);

            traktMovieRelease.Should().NotBeNull();
            traktMovieRelease.CountryCode.Should().BeNull();
            traktMovieRelease.Certification.Should().Be("PG-13");
            traktMovieRelease.ReleaseDate.Should().BeNull();
            traktMovieRelease.ReleaseType.Should().BeNull();
            traktMovieRelease.Note.Should().BeNull();
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Json_String_Incomplete_3()
        {
            var jsonReader = new MovieReleaseObjectJsonReader();

            var traktMovieRelease = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_3);

            traktMovieRelease.Should().NotBeNull();
            traktMovieRelease.CountryCode.Should().Be("us");
            traktMovieRelease.Certification.Should().Be("PG-13");
            traktMovieRelease.ReleaseDate.Should().BeNull();
            traktMovieRelease.ReleaseType.Should().Be(TraktReleaseType.Premiere);
            traktMovieRelease.Note.Should().Be("Los Angeles, California");
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Json_String_Incomplete_5()
        {
            var jsonReader = new MovieReleaseObjectJsonReader();

            var traktMovieRelease = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_5);

            traktMovieRelease.Should().NotBeNull();
            traktMovieRelease.CountryCode.Should().Be("us");
            traktMovieRelease.Certification.Should().Be("PG-13");
            traktMovieRelease.ReleaseDate.Should().Be(DateTime.Parse("2015-12-14"));
            traktMovieRelease.ReleaseType.Should().Be(TraktReleaseType.Premiere);
            traktMovieRelease.Note.Should().BeNull();
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Json_String_Not_Valid_6()
        {
            var jsonReader = new MovieReleaseObjectJsonReader();

            var traktMovieRelease = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_6);

            traktMovieRelease.Should().NotBeNull();
            traktMovieRelease.CountryCode.Should().BeNull();
            traktMovieRelease.Certification.Should().BeNull();
            traktMovieRelease.ReleaseDate.Should().BeNull();
            traktMovieRelease.ReleaseType.Should().BeNull();
            traktMovieRelease.Note.Should().BeNull();
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Stream_Incomplete_4()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_4.ToStream())
            {
                var traktMovieRelease = await traktJsonReader.ReadObjectAsync(stream);

                traktMovieRelease.Should().NotBeNull();
                traktMovieRelease.CountryCode.Should().Be("us");
                traktMovieRelease.Certification.Should().Be("PG-13");
                traktMovieRelease.ReleaseDate.Should().Be(DateTime.Parse("2015-12-14"));
                traktMovieRelease.ReleaseType.Should().BeNull();
                traktMovieRelease.Note.Should().Be("Los Angeles, California");
            }
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Stream_Not_Valid_6()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

            using (var stream = JSON_NOT_VALID_6.ToStream())
            {
                var traktMovieRelease = await traktJsonReader.ReadObjectAsync(stream);

                traktMovieRelease.Should().NotBeNull();
                traktMovieRelease.CountryCode.Should().BeNull();
                traktMovieRelease.Certification.Should().BeNull();
                traktMovieRelease.ReleaseDate.Should().BeNull();
                traktMovieRelease.ReleaseType.Should().BeNull();
                traktMovieRelease.Note.Should().BeNull();
            }
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Stream_Not_Valid_5()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

            using (var stream = JSON_NOT_VALID_5.ToStream())
            {
                var traktMovieRelease = await traktJsonReader.ReadObjectAsync(stream);

                traktMovieRelease.Should().NotBeNull();
                traktMovieRelease.CountryCode.Should().Be("us");
                traktMovieRelease.Certification.Should().Be("PG-13");
                traktMovieRelease.ReleaseDate.Should().Be(DateTime.Parse("2015-12-14"));
                traktMovieRelease.ReleaseType.Should().Be(TraktReleaseType.Premiere);
                traktMovieRelease.Note.Should().BeNull();
            }
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Stream_Incomplete_9()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_9.ToStream())
            {
                var traktMovieRelease = await traktJsonReader.ReadObjectAsync(stream);

                traktMovieRelease.Should().NotBeNull();
                traktMovieRelease.CountryCode.Should().BeNull();
                traktMovieRelease.Certification.Should().BeNull();
                traktMovieRelease.ReleaseDate.Should().BeNull();
                traktMovieRelease.ReleaseType.Should().Be(TraktReleaseType.Premiere);
                traktMovieRelease.Note.Should().BeNull();
            }
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_JsonReader_Incomplete_9()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

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

                    traktMovieRelease.Should().NotBeNull();
                    traktMovieRelease.CountryCode.Should().BeNull();
                    traktMovieRelease.Certification.Should().BeNull();
                    traktMovieRelease.ReleaseDate.Should().BeNull();
                    traktMovieRelease.ReleaseType.Should().Be(TraktReleaseType.Premiere);
                    traktMovieRelease.Note.Should().BeNull();
                }
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

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

                    traktMovieRelease.Should().NotBeNull();
                    traktMovieRelease.CountryCode.Should().Be("us");
                    traktMovieRelease.Certification.Should().Be("PG-13");
                    traktMovieRelease.ReleaseDate.Should().BeNull();
                    traktMovieRelease.ReleaseType.Should().Be(TraktReleaseType.Premiere);
                    traktMovieRelease.Note.Should().Be("Los Angeles, California");
                }
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_6()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

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

                    traktMovieRelease.Should().NotBeNull();
                    traktMovieRelease.CountryCode.Should().BeNull();
                    traktMovieRelease.Certification.Should().BeNull();
                    traktMovieRelease.ReleaseDate.Should().BeNull();
                    traktMovieRelease.ReleaseType.Should().BeNull();
                    traktMovieRelease.Note.Should().BeNull();
                }
        }
        public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new MovieReleaseObjectJsonReader();

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

                    traktMovieRelease.Should().NotBeNull();
                    traktMovieRelease.CountryCode.Should().Be("us");
                    traktMovieRelease.Certification.Should().BeNull();
                    traktMovieRelease.ReleaseDate.Should().Be(DateTime.Parse("2015-12-14"));
                    traktMovieRelease.ReleaseType.Should().Be(TraktReleaseType.Premiere);
                    traktMovieRelease.Note.Should().Be("Los Angeles, California");
                }
        }
Exemplo n.º 20
0
 public async Task Test_MovieReleaseObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new MovieReleaseObjectJsonReader();
     Func <Task <ITraktMovieRelease> > traktMovieRelease = () => jsonReader.ReadObjectAsync(default(string));
     await traktMovieRelease.Should().ThrowAsync <ArgumentNullException>();
 }