Exemplo n.º 1
0
        public void Body()
        {
            var resolver = ParameterResolver.Body <NameData>();

            var result   = resolver.Apply(_request, _mappedParameters);
            var expected = new NameData("John", "Doe");

            Assert.Equal(expected.ToString(), result.ToString());
            Assert.Equal(ParameterResolver.Type.Body, resolver.Type);
        }
Exemplo n.º 2
0
        public void BodyWithContentTypeMapper()
        {
            var mediaTypeMapper = new MediaTypeMapper.Builder()
                                  .AddMapperFor(ContentMediaType.Json, DefaultJsonMapper.Instance)
                                  .Build();

            var resolver = ParameterResolver.Body <NameData>(mediaTypeMapper);

            var result   = resolver.Apply(_request, _mappedParameters);
            var expected = new NameData("John", "Doe");

            Assert.Equal(expected.ToString(), result.ToString());
            Assert.Equal(ParameterResolver.Type.Body, resolver.Type);
        }