public async Task EchoPocoTypesDefaultFormatterWorks() { var input = new SomePoco { Id = 7, Name = "testName", }; var request = new HttpRequestMessage(HttpMethod.Post, "Echo/EchoPoco"); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); request.Content = new ObjectContent <SomePoco>(input, new JsonMediaTypeFormatter()); var response = await DefaultClient.SendAsync(request); Assert.True(response.IsSuccessStatusCode); var echo = await response.Content.ReadAsAsync <SomePoco>(new[] { new JsonMediaTypeFormatter() }); Assert.Equal(input.Id, echo.Id); Assert.Equal(input.Name, echo.Name); }
public SomePoco EchoPoco([FromBody] SomePoco poco) { return(poco); }