本文整理汇总了C#中NancyContext.JsonBody方法的典型用法代码示例。如果您正苦于以下问题:C# NancyContext.JsonBody方法的具体用法?C# NancyContext.JsonBody怎么用?C# NancyContext.JsonBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NancyContext
的用法示例。
在下文中一共展示了NancyContext.JsonBody方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_create_new_wrapper_from_json_response_if_not_already_present
public void Should_create_new_wrapper_from_json_response_if_not_already_present()
{
var response = new JsonResponse<Model>(new Model() { Dummy = "Data" });
var context = new NancyContext() { Response = response };
var result = context.JsonBody<Model>();
result.Dummy.ShouldEqual("Data");
}
示例2: Should_use_jsonresponse_from_context_if_it_is_present
public void Should_use_jsonresponse_from_context_if_it_is_present()
{
var model = new Model() { Dummy = "Data" };
var context = new NancyContext();
context.Items["@@@@[email protected]@@@"] = model; // Yucky hardcoded stringyness
var result = context.JsonBody<Model>();
result.ShouldBeSameAs(model);
}
示例3: Should_create_new_wrapper_from_json_response_if_not_already_present
public void Should_create_new_wrapper_from_json_response_if_not_already_present()
{
// Given
var response = new JsonResponse<Model>(new Model() { Dummy = "Data" }, new DefaultJsonSerializer());
var context = new NancyContext() { Response = response };
// When
var result = context.JsonBody<Model>();
// Then
result.Dummy.ShouldEqual("Data");
}