Quantcast
Channel: ASP.NET MVC / Web API / Web Pages
Viewing all articles
Browse latest Browse all 7925

Commented Unassigned: UrlHelper class in Web API is hard to mock [977]

$
0
0
None of the methods are virtual making it hard to mock and hence test. It would be great if these could be made virtual:

public string Link(string routeName, IDictionary<string, object> routeValues);
public string Link(string routeName, object routeValues);
public string Route(string routeName, IDictionary<string, object> routeValues);
public string Route(string routeName, object routeValues);

Thanks

Henrik
Comments: This is already fixed. See the spec at https://aspnetwebstack.codeplex.com/wikipage?title=Improving%20ApiController%20testability&referringTitle=Specs and the commit that fixed it at https://aspnetwebstack.codeplex.com/SourceControl/changeset/522ca1b4013566990732bc1cb96f5ac469c24596

Viewing all articles
Browse latest Browse all 7925

Trending Articles