本文整理汇总了C#中FileSystemHelper.NormalizeWebPath方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystemHelper.NormalizeWebPath方法的具体用法?C# FileSystemHelper.NormalizeWebPath怎么用?C# FileSystemHelper.NormalizeWebPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystemHelper
的用法示例。
在下文中一共展示了FileSystemHelper.NormalizeWebPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Normalize_Web_Path_Absolute
public void Normalize_Web_Path_Absolute()
{
var url = "/test/hello.js";
var helper = new FileSystemHelper(
Mock.Of<IApplicationEnvironment>(),
Mock.Of<IHostingEnvironment>(x => x.WebRootPath == "C:\\MySolution\\MyProject"),
Mock.Of<ISmidgeConfig>());
var result = helper.NormalizeWebPath(url, Mock.Of<HttpRequest>(x => x.Scheme == "http"));
Assert.Equal("test/hello.js", result);
}
示例2: Normalize_Web_Path_External_Schemaless
public void Normalize_Web_Path_External_Schemaless()
{
var url = "//test.com/hello.js";
var urlHelper = new Mock<IUrlHelper>();
urlHelper.Setup(x => x.Content(It.IsAny<string>())).Returns<string>(s => s);
var helper = new FileSystemHelper(
Mock.Of<IApplicationEnvironment>(),
Mock.Of<IHostingEnvironment>(x => x.WebRootPath == "C:\\MySolution\\MyProject"),
Mock.Of<ISmidgeConfig>(),
urlHelper.Object);
var result = helper.NormalizeWebPath(url, Mock.Of<HttpRequest>(x => x.Scheme == "http"));
Assert.Equal("http://test.com/hello.js", result);
}