コード例 #1
0
        public async Task Test_LanguageObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var            jsonReader    = new LanguageObjectJsonReader();
            ITraktLanguage traktLanguage = await jsonReader.ReadObjectAsync(string.Empty);

            traktLanguage.Should().BeNull();
        }
コード例 #2
0
        public void Test_LanguageObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new LanguageObjectJsonReader();
            Func <Task <ITraktLanguage> > traktLanguage = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktLanguage.Should().Throw <ArgumentNullException>();
        }
コード例 #3
0
        public async Task Test_LanguageObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var            jsonReader    = new LanguageObjectJsonReader();
            ITraktLanguage traktLanguage = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktLanguage.Should().NotBeNull();
            traktLanguage.Name.Should().BeNull();
            traktLanguage.Code.Should().BeNull();
        }
コード例 #4
0
        public async Task Test_LanguageObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var            jsonReader    = new LanguageObjectJsonReader();
            ITraktLanguage traktLanguage = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            traktLanguage.Should().NotBeNull();
            traktLanguage.Name.Should().Be("English");
            traktLanguage.Code.Should().BeNull();
        }
コード例 #5
0
        public async Task Test_TraktLanguage_From_Json()
        {
            var jsonReader    = new LanguageObjectJsonReader();
            var traktLanguage = await jsonReader.ReadObjectAsync(JSON) as TraktLanguage;

            traktLanguage.Should().NotBeNull();
            traktLanguage.Name.Should().Be("English");
            traktLanguage.Code.Should().Be("en");
        }
        public async Task Test_LanguageObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new LanguageObjectJsonReader();

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

                traktLanguage.Should().BeNull();
            }
        }
コード例 #7
0
        public async Task Test_LanguageObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new LanguageObjectJsonReader();

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

                    traktLanguage.Should().BeNull();
                }
        }
        public async Task Test_LanguageObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new LanguageObjectJsonReader();

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

                traktLanguage.Should().NotBeNull();
                traktLanguage.Name.Should().BeNull();
                traktLanguage.Code.Should().BeNull();
            }
        }
        public async Task Test_LanguageObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var traktJsonReader = new LanguageObjectJsonReader();

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

                traktLanguage.Should().NotBeNull();
                traktLanguage.Name.Should().Be("English");
                traktLanguage.Code.Should().BeNull();
            }
        }
コード例 #10
0
        public async Task Test_LanguageObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new LanguageObjectJsonReader();

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

                    traktLanguage.Should().NotBeNull();
                    traktLanguage.Name.Should().BeNull();
                    traktLanguage.Code.Should().BeNull();
                }
        }
コード例 #11
0
        public async Task Test_LanguageObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new LanguageObjectJsonReader();

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

                    traktLanguage.Should().NotBeNull();
                    traktLanguage.Name.Should().Be("English");
                    traktLanguage.Code.Should().BeNull();
                }
        }
コード例 #12
0
 public async Task Test_LanguageObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new LanguageObjectJsonReader();
     Func <Task <ITraktLanguage> > traktLanguage = () => jsonReader.ReadObjectAsync(default(string));
     await traktLanguage.Should().ThrowAsync <ArgumentNullException>();
 }