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

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -