我有一些UrlHelper
我想进行单元测试的扩展方法。但是,当路径以“~/”开头时,我NullReferenceException
会从方法中得到一个。UrlHelper.Content(string)
有谁知道是什么问题?
[Test]
public void DummyTest()
{
var context = new Mock<HttpContextBase>();
RequestContext requestContext = new RequestContext(context.Object, new RouteData());
UrlHelper urlHelper = new UrlHelper(requestContext);
string path = urlHelper.Content("~/test.png");
Assert.IsNotNullOrEmpty(path);
}