Exemple #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>();
        }
Exemple #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();
        }
Exemple #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();
        }
Exemple #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");
        }
Exemple #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();
        }
Exemple #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");
        }
Exemple #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();
            }
        }
Exemple #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();
                }
        }
Exemple #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();
            }
        }
Exemple #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");
            }
        }
Exemple #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();
                }
        }
Exemple #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");
                }
        }
Exemple #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>();
 }