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!
精彩评论