Exemple #1
0
        public void Test_MovieTranslationObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();
            Func <Task <ITraktMovieTranslation> > traktMovieTranslation = () => traktJsonReader.ReadObjectAsync(default(Stream));

            traktMovieTranslation.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

            var traktMovieTranslation = await traktJsonReader.ReadObjectAsync(default(JsonTextReader));
            traktMovieTranslation.Should().BeNull();
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new MovieTranslationObjectJsonReader();

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

            traktMovieTranslation.Should().BeNull();
        }
        public async Task Test_TraktMovieTranslation_From_Json()
        {
            var jsonReader       = new MovieTranslationObjectJsonReader();
            var movieTranslation = await jsonReader.ReadObjectAsync(JSON) as TraktMovieTranslation;

            movieTranslation.Should().NotBeNull();
            movieTranslation.Title.Should().Be("Star Wars: Episode VII - The Force Awakens");
            movieTranslation.Overview.Should().Be("A continuation of the saga created by George Lucas, set thirty years after Star Wars: Episode VI – Return of the Jedi.");
            movieTranslation.Tagline.Should().Be("The Force Lives On...");
            movieTranslation.LanguageCode.Should().Be("en");
        }
Exemple #5
0
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

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

                traktMovieTranslation.Should().BeNull();
            }
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

            using (var reader = new StringReader(string.Empty))
            using (var jsonReader = new JsonTextReader(reader))
            {
                var traktMovieTranslation = await traktJsonReader.ReadObjectAsync(jsonReader);
                traktMovieTranslation.Should().BeNull();
            }
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Json_String_Incomplete_8()
        {
            var jsonReader = new MovieTranslationObjectJsonReader();

            var traktMovieTranslation = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_8);

            traktMovieTranslation.Should().NotBeNull();
            traktMovieTranslation.Title.Should().BeNull();
            traktMovieTranslation.Overview.Should().BeNull();
            traktMovieTranslation.Tagline.Should().BeNull();
            traktMovieTranslation.LanguageCode.Should().Be("en");
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Json_String_Not_Valid_5()
        {
            var jsonReader = new MovieTranslationObjectJsonReader();

            var traktMovieTranslation = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_5);

            traktMovieTranslation.Should().NotBeNull();
            traktMovieTranslation.Title.Should().BeNull();
            traktMovieTranslation.Overview.Should().BeNull();
            traktMovieTranslation.Tagline.Should().BeNull();
            traktMovieTranslation.LanguageCode.Should().BeNull();
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Json_String_Incomplete_6()
        {
            var jsonReader = new MovieTranslationObjectJsonReader();

            var traktMovieTranslation = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_6);

            traktMovieTranslation.Should().NotBeNull();
            traktMovieTranslation.Title.Should().BeNull();
            traktMovieTranslation.Overview.Should().Be("A continuation of the saga created by George Lucas, set thirty years after Star Wars: Episode VI – Return of the Jedi.");
            traktMovieTranslation.Tagline.Should().BeNull();
            traktMovieTranslation.LanguageCode.Should().BeNull();
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Json_String_Incomplete_5()
        {
            var jsonReader = new MovieTranslationObjectJsonReader();

            var traktMovieTranslation = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_5);

            traktMovieTranslation.Should().NotBeNull();
            traktMovieTranslation.Title.Should().Be("Star Wars: Episode VII - The Force Awakens");
            traktMovieTranslation.Overview.Should().BeNull();
            traktMovieTranslation.Tagline.Should().BeNull();
            traktMovieTranslation.LanguageCode.Should().BeNull();
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new MovieTranslationObjectJsonReader();

            var traktMovieTranslation = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            traktMovieTranslation.Should().NotBeNull();
            traktMovieTranslation.Title.Should().Be("Star Wars: Episode VII - The Force Awakens");
            traktMovieTranslation.Overview.Should().BeNull();
            traktMovieTranslation.Tagline.Should().Be("The Force Lives On...");
            traktMovieTranslation.LanguageCode.Should().Be("en");
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new MovieTranslationObjectJsonReader();

            var traktMovieTranslation = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktMovieTranslation.Should().NotBeNull();
            traktMovieTranslation.Title.Should().Be("Star Wars: Episode VII - The Force Awakens");
            traktMovieTranslation.Overview.Should().Be("A continuation of the saga created by George Lucas, set thirty years after Star Wars: Episode VI – Return of the Jedi.");
            traktMovieTranslation.Tagline.Should().BeNull();
            traktMovieTranslation.LanguageCode.Should().Be("en");
        }
Exemple #13
0
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_2.ToStream())
            {
                var traktMovieTranslation = await traktJsonReader.ReadObjectAsync(stream);

                traktMovieTranslation.Should().NotBeNull();
                traktMovieTranslation.Title.Should().Be("Star Wars: Episode VII - The Force Awakens");
                traktMovieTranslation.Overview.Should().BeNull();
                traktMovieTranslation.Tagline.Should().Be("The Force Lives On...");
                traktMovieTranslation.LanguageCode.Should().Be("en");
            }
        }
Exemple #14
0
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Stream_Not_Valid_5()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

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

                traktMovieTranslation.Should().NotBeNull();
                traktMovieTranslation.Title.Should().BeNull();
                traktMovieTranslation.Overview.Should().BeNull();
                traktMovieTranslation.Tagline.Should().BeNull();
                traktMovieTranslation.LanguageCode.Should().BeNull();
            }
        }
Exemple #15
0
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Stream_Incomplete_8()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_8.ToStream())
            {
                var traktMovieTranslation = await traktJsonReader.ReadObjectAsync(stream);

                traktMovieTranslation.Should().NotBeNull();
                traktMovieTranslation.Title.Should().BeNull();
                traktMovieTranslation.Overview.Should().BeNull();
                traktMovieTranslation.Tagline.Should().BeNull();
                traktMovieTranslation.LanguageCode.Should().Be("en");
            }
        }
Exemple #16
0
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_Stream_Incomplete_4()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

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

                traktMovieTranslation.Should().NotBeNull();
                traktMovieTranslation.Title.Should().Be("Star Wars: Episode VII - The Force Awakens");
                traktMovieTranslation.Overview.Should().Be("A continuation of the saga created by George Lucas, set thirty years after Star Wars: Episode VI – Return of the Jedi.");
                traktMovieTranslation.Tagline.Should().Be("The Force Lives On...");
                traktMovieTranslation.LanguageCode.Should().BeNull();
            }
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_JsonReader_Incomplete_3()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

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

                    traktMovieTranslation.Should().NotBeNull();
                    traktMovieTranslation.Title.Should().Be("Star Wars: Episode VII - The Force Awakens");
                    traktMovieTranslation.Overview.Should().Be("A continuation of the saga created by George Lucas, set thirty years after Star Wars: Episode VI – Return of the Jedi.");
                    traktMovieTranslation.Tagline.Should().BeNull();
                    traktMovieTranslation.LanguageCode.Should().Be("en");
                }
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_5()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

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

                    traktMovieTranslation.Should().NotBeNull();
                    traktMovieTranslation.Title.Should().BeNull();
                    traktMovieTranslation.Overview.Should().BeNull();
                    traktMovieTranslation.Tagline.Should().BeNull();
                    traktMovieTranslation.LanguageCode.Should().BeNull();
                }
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_JsonReader_Incomplete_7()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

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

                    traktMovieTranslation.Should().NotBeNull();
                    traktMovieTranslation.Title.Should().BeNull();
                    traktMovieTranslation.Overview.Should().BeNull();
                    traktMovieTranslation.Tagline.Should().Be("The Force Lives On...");
                    traktMovieTranslation.LanguageCode.Should().BeNull();
                }
        }
        public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_1()
        {
            var traktJsonReader = new MovieTranslationObjectJsonReader();

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

                    traktMovieTranslation.Should().NotBeNull();
                    traktMovieTranslation.Title.Should().BeNull();
                    traktMovieTranslation.Overview.Should().Be("A continuation of the saga created by George Lucas, set thirty years after Star Wars: Episode VI – Return of the Jedi.");
                    traktMovieTranslation.Tagline.Should().Be("The Force Lives On...");
                    traktMovieTranslation.LanguageCode.Should().Be("en");
                }
        }
 public async Task Test_MovieTranslationObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new MovieTranslationObjectJsonReader();
     Func <Task <ITraktMovieTranslation> > traktMovieTranslation = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktMovieTranslation.Should().ThrowAsync <ArgumentNullException>();
 }