public void Test_ShowAliasObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new ShowAliasObjectJsonReader();
            Func <Task <ITraktShowAlias> > traktShowAlias = () => jsonReader.ReadObjectAsync(default(string));

            traktShowAlias.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

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

            traktShowAlias.Should().BeNull();
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new ShowAliasObjectJsonReader();

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

            traktShowAlias.Should().BeNull();
        }
        public async Task Test_TraktShowAlias_From_Json()
        {
            var jsonReader = new ShowAliasObjectJsonReader();
            var showAlias  = await jsonReader.ReadObjectAsync(JSON) as TraktShowAlias;

            showAlias.Should().NotBeNull();
            showAlias.Title.Should().Be("Game of Thrones- Das Lied von Eis und Feuer");
            showAlias.CountryCode.Should().Be("de");
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Json_String_Incomplete_1()
        {
            var jsonReader = new ShowAliasObjectJsonReader();

            var traktShowAlias = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_1);

            traktShowAlias.Should().NotBeNull();
            traktShowAlias.Title.Should().Be("Game of Thrones- Das Lied von Eis und Feuer");
            traktShowAlias.CountryCode.Should().BeNull();
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new ShowAliasObjectJsonReader();

            var traktShowAlias = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            traktShowAlias.Should().NotBeNull();
            traktShowAlias.Title.Should().Be("Game of Thrones- Das Lied von Eis und Feuer");
            traktShowAlias.CountryCode.Should().BeNull();
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new ShowAliasObjectJsonReader();

            var traktShowAlias = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktShowAlias.Should().NotBeNull();
            traktShowAlias.Title.Should().BeNull();
            traktShowAlias.CountryCode.Should().BeNull();
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new ShowAliasObjectJsonReader();

            var traktShowAlias = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            traktShowAlias.Should().NotBeNull();
            traktShowAlias.Title.Should().BeNull();
            traktShowAlias.CountryCode.Should().Be("de");
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

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

                traktShowAlias.Should().BeNull();
            }
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

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

                    traktShowAlias.Should().BeNull();
                }
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var traktShowAlias = await traktJsonReader.ReadObjectAsync(stream);

                traktShowAlias.Should().NotBeNull();
                traktShowAlias.Title.Should().BeNull();
                traktShowAlias.CountryCode.Should().BeNull();
            }
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Stream_Not_Valid_2()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

            using (var stream = JSON_NOT_VALID_2.ToStream())
            {
                var traktShowAlias = await traktJsonReader.ReadObjectAsync(stream);

                traktShowAlias.Should().NotBeNull();
                traktShowAlias.Title.Should().Be("Game of Thrones- Das Lied von Eis und Feuer");
                traktShowAlias.CountryCode.Should().BeNull();
            }
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Stream_Incomplete_1()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_1.ToStream())
            {
                var traktShowAlias = await traktJsonReader.ReadObjectAsync(stream);

                traktShowAlias.Should().NotBeNull();
                traktShowAlias.Title.Should().Be("Game of Thrones- Das Lied von Eis und Feuer");
                traktShowAlias.CountryCode.Should().BeNull();
            }
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

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

                traktShowAlias.Should().NotBeNull();
                traktShowAlias.Title.Should().BeNull();
                traktShowAlias.CountryCode.Should().Be("de");
            }
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

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

                    traktShowAlias.Should().NotBeNull();
                    traktShowAlias.Title.Should().BeNull();
                    traktShowAlias.CountryCode.Should().Be("de");
                }
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

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

                    traktShowAlias.Should().NotBeNull();
                    traktShowAlias.Title.Should().Be("Game of Thrones- Das Lied von Eis und Feuer");
                    traktShowAlias.CountryCode.Should().Be("de");
                }
        }
        public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new ShowAliasObjectJsonReader();

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

                    traktShowAlias.Should().NotBeNull();
                    traktShowAlias.Title.Should().BeNull();
                    traktShowAlias.CountryCode.Should().BeNull();
                }
        }
Exemplo n.º 18
0
 public async Task Test_ShowAliasObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new ShowAliasObjectJsonReader();
     Func <Task <ITraktShowAlias> > traktShowAlias = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktShowAlias.Should().ThrowAsync <ArgumentNullException>();
 }