moq - How can I generate ASP.NET MVC URLs inside a unit test project? -
How can I generate URLs related to Controller, Action, and Parameters (for a given ASP.NET MVC project) Am I another project (class library used for testing)?
I have yet found HtmlHelper.GenerateRouteLink , but still the correct request context and route archive.
Try it out:
var routes = new route controls () ; MvcApplication.RegisterRoutes (routes); Var reference = new fake & lt; HttpContextBase & gt; (); Var urlHelper = New UrlHelper (new requestcontent (reference object, new root data ()), route); Var url = urlHelper.Action ("action", "controller", new {id = ...});
to
Comments
Post a Comment