本文整理汇总了C#中NancyContext.ToFullPath方法的典型用法代码示例。如果您正苦于以下问题:C# NancyContext.ToFullPath方法的具体用法?C# NancyContext.ToFullPath怎么用?C# NancyContext.ToFullPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NancyContext
的用法示例。
在下文中一共展示了NancyContext.ToFullPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_replace_tilde_with_nothing_when_parsing_path_if_one_present_and_base_path_is_null
public void Should_replace_tilde_with_nothing_when_parsing_path_if_one_present_and_base_path_is_null()
{
const string input = "~/scripts/test.js";
var url = new Url
{
BasePath = null,
Path = "/"
};
var request = new Request("GET", url);
var nancyContext = new NancyContext { Request = request };
var result = nancyContext.ToFullPath(input);
result.ShouldEqual("/scripts/test.js");
}
示例2: Should_return_same_path_when_parsing_path_if_path_doesnt_contain_tilde
public void Should_return_same_path_when_parsing_path_if_path_doesnt_contain_tilde()
{
// Given
const string input = "/scripts/test.js";
var url = new Url
{
BasePath = "/base/path",
Path = "/"
};
var request = new Request("GET", url);
var nancyContext = new NancyContext { Request = request };
// When
var result = nancyContext.ToFullPath(input);
// Then
result.ShouldEqual(input);
}
示例3: Should_replace_tilde_with_base_path_when_parsing_path_if_one_present
public void Should_replace_tilde_with_base_path_when_parsing_path_if_one_present()
{
// Given
const string input = "~/scripts/test.js";
var url = new Url
{
BasePath = "/base/path/",
Path = "/"
};
var request = new Request("GET", url);
var nancyContext = new NancyContext { Request = request };
// When
var result = nancyContext.ToFullPath(input);
// Then
result.ShouldEqual("/base/path/scripts/test.js");
}