开发者

Use VirtualPathUtility.ToAbsolute in unit test?

I get the following exception when I use VirtualPathUtility.ToAbsolute(virtualUrl) in a unit test : System.Web.HttpException : The application relative virtual p开发者_StackOverflow社区ath '~/page/myaction' cannot be made absolute, because the path to the application is not known.

How can I solve this?


It would be best to break the dependency on it by wrapping it up in another class (using an interface). Then, in your unit test you can mock your class via it's interface.

I'm just doing exactly that!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜