Пример #1
0
        public async Task Throws_HttpContentSerializationException_If_Content_Is_Null()
        {
            var         serializer = new MockedHttpContentSerializer();
            Func <Task> testCode   = async() => await serializer.DeserializeAsync(null, typeof(object));

            await testCode.Should().ThrowAsync <HttpContentSerializationException>();
        }
Пример #2
0
        public async Task Deserializes_NoContent()
        {
            var serializer = new MockedHttpContentSerializer();
            var content    = new ByteArrayContent(new byte[0]);
            var result     = await serializer.DeserializeAsync(content, typeof(NoContent));

            result.Should().BeOfType <NoContent>();
        }
Пример #3
0
        public async Task Throws_ArgumentNullException_For_ContentType()
        {
            var serializer = new MockedHttpContentSerializer();
            var content    = new ByteArrayContent(new byte[0]);

            Func <Task> testCode = async() => await serializer.DeserializeAsync(content, null);

            await testCode.Should().ThrowAsync <ArgumentNullException>();
        }
Пример #4
0
 public async Task Doesnt_Throw_HttpContentSerializationException_If_Content_Is_Null_And_Deserializing_NoContent()
 {
     var serializer = new MockedHttpContentSerializer();
     await serializer.DeserializeAsync(null, typeof(NoContent)); // Should not throw.
 }