Hi
I'm trying to unit test an ExecuteResult() method of a custom ActionResult. The method uses UrlHelper.GenerateUrl() method to generate the url for given action and controller.
In the unit test I'm constructing the ControllerContext like such:
And then setting static mock for the UrlHelper:
When the runtime hots the GenerateUrl method I'm getting the System.Security.VerificationException "Operation could destabilize the runtime.". The stack trace is not very helpful:
The GenerateUrl() method works fine when I remove static mock declaration but that makes the whole test pointless. Any help please?