示例#1
0
        public void Test_ErrorObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new ErrorObjectJsonReader();
            Func <Task <ITraktError> > traktError = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktError.Should().Throw <ArgumentNullException>();
        }
示例#2
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new ErrorObjectJsonReader();

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

            traktError.Should().BeNull();
        }
示例#3
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new ErrorObjectJsonReader();

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

            traktError.Should().BeNull();
        }
示例#4
0
        public async Task Test_TraktError_From_Json()
        {
            var jsonReader = new ErrorObjectJsonReader();
            var traktError = await jsonReader.ReadObjectAsync(JSON) as TraktError;

            traktError.Should().NotBeNull();
            traktError.Error.Should().Be("trakt error");
            traktError.Description.Should().Be("trakt error description");
        }
示例#5
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new ErrorObjectJsonReader();

            var traktError = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktError.Should().NotBeNull();
            traktError.Error.Should().BeNull();
            traktError.Description.Should().BeNull();
        }
示例#6
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new ErrorObjectJsonReader();

            var traktError = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            traktError.Should().NotBeNull();
            traktError.Error.Should().BeNull();
            traktError.Description.Should().Be("trakt error description");
        }
示例#7
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new ErrorObjectJsonReader();

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

                traktError.Should().BeNull();
            }
        }
示例#8
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new ErrorObjectJsonReader();

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

                    traktError.Should().BeNull();
                }
        }
示例#9
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new ErrorObjectJsonReader();

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

                traktError.Should().NotBeNull();
                traktError.Error.Should().BeNull();
                traktError.Description.Should().BeNull();
            }
        }
示例#10
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var traktJsonReader = new ErrorObjectJsonReader();

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

                traktError.Should().NotBeNull();
                traktError.Error.Should().BeNull();
                traktError.Description.Should().Be("trakt error description");
            }
        }
示例#11
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new ErrorObjectJsonReader();

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

                    traktError.Should().NotBeNull();
                    traktError.Error.Should().BeNull();
                    traktError.Description.Should().BeNull();
                }
        }
示例#12
0
        public async Task Test_ErrorObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new ErrorObjectJsonReader();

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

                    traktError.Should().NotBeNull();
                    traktError.Error.Should().BeNull();
                    traktError.Description.Should().Be("trakt error description");
                }
        }
示例#13
0
 public async Task Test_ErrorObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new ErrorObjectJsonReader();
     Func <Task <ITraktError> > traktError = () => jsonReader.ReadObjectAsync(default(string));
     await traktError.Should().ThrowAsync <ArgumentNullException>();
 }