The documentation suggests that NancyFx helps me deserialize the WRT of the json request body, but I'm not sure how to do it. See the demo below:
[TestFixture] public class ScratchNancy { [Test] public void RootTest() { var result = new Browser(new DefaultNancyBootstrapper()).Post( "/", with => { with.HttpRequest(); with.JsonBody(JsonConvert.SerializeObject(new DTO {Name = "Dto", Value = 9})); }); Assert.AreEqual(HttpStatusCode.OK, result.StatusCode); } public class RootModule : NancyModule { public RootModule() { Post["/"] = Root; } private Response Root(dynamic o) { DTO dto = null;
Myles mcdonnell
source share