本文整理汇总了C#中NancyContext.DocumentBody方法的典型用法代码示例。如果您正苦于以下问题:C# NancyContext.DocumentBody方法的具体用法?C# NancyContext.DocumentBody怎么用?C# NancyContext.DocumentBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NancyContext
的用法示例。
在下文中一共展示了NancyContext.DocumentBody方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_use_documentwrapper_from_context_if_it_is_present
public void Should_use_documentwrapper_from_context_if_it_is_present()
{
var wrapper = new DocumentWrapper("<html></html>");
var context = new NancyContext();
context.Items["@@@@[email protected]@@@"] = wrapper; // Yucky hardcoded stringyness
var result = context.DocumentBody();
result.ShouldBeSameAs(wrapper);
}
示例2: Should_use_documentwrapper_from_context_if_it_is_present
public void Should_use_documentwrapper_from_context_if_it_is_present()
{
// Given
var buffer =
Encoding.UTF8.GetBytes("<html></html>");
var wrapper = new DocumentWrapper(buffer);
var context = new NancyContext();
context.Items["@@@@[email protected]@@@"] = wrapper; // Yucky hardcoded stringyness
// When
var result = context.DocumentBody();
// Then
result.ShouldBeSameAs(wrapper);
}
示例3: Should_create_new_wrapper_from_html_response_if_not_already_present
public void Should_create_new_wrapper_from_html_response_if_not_already_present()
{
var called = false;
var bodyBytes = Encoding.ASCII.GetBytes("<html></html>");
Action<Stream> bodyDelegate = (s) =>
{
s.Write(bodyBytes, 0, bodyBytes.Length);
called = true;
};
var response = new Response { Contents = bodyDelegate };
var context = new NancyContext() { Response = response };
var result = context.DocumentBody();
result.ShouldBeOfType(typeof(DocumentWrapper));
called.ShouldBeTrue();
}