예제 #1
0
    public async Task NonMergePatchJsonContentType_ReadJsonPatchAsync_ReturnsNull()
    {
        var content = new ByteArrayContent(new byte[0]);

        content.Headers.ContentType = new MediaTypeHeaderValue("application/not-merge-patch+json");
        var typeRepository = Substitute.For <ITypeRepository>();

        typeRepository.TryGet(typeof(TestDto), out Arg.Any <Type>()).Returns(callInfo => { callInfo[1] = typeof(TestDtoWrapped); return(true); });
        var result = await content.ReadJsonPatchAsync <TestDto>(typeRepository).ConfigureAwait(false);

        Assert.Null(result);
    }