ASP.NET MVC Custom Route Constraints, Dependency Injection and Unit Testing
About this topic, I have asked another question: ASP.NET MVC Custom Route Constraints and Dependency Injection Here is the current situation: on my ASP.NET MVC 3 App, I have a route constraint defined like below: public class CountryRouteConstraint : IRouteConstraint { private readonly ICountryRepository<Country> _countryRepo; public CountryRouteConstraint(ICountryRepository<Country> countryRepo) { _countryRepo = countryRepo; } public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { //do the database look