Closed bapti closed 9 years ago
I have the following code for setting up my MVC routes
public static void RegisterAllRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapMvcAttributeRoutes(); RegisterAreas(routes); RegisterConventionRoutes(routes); }
I see from your code that you've got routes.MapAttributeRoutesInAssembly(typeof(HomeAttrController)); for setting up the routing for testing.
routes.MapAttributeRoutesInAssembly(typeof(HomeAttrController));
Should I be doing something like this?
public static void RegisterAllRoutes(RouteCollection routes, Action registerAttributesAction) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); registerAttributesAction.Invoke(); } // Prod code RegisterAllRoutes(routes, () => { routes.MapMvcAttributeRoutes();}); // Test code RegisterAllRoutes(routes, () => { routes.MapAttributeRoutesInAssembly();});
Would this be the best pattern for testing do you think?
I have the following code for setting up my MVC routes
I see from your code that you've got
routes.MapAttributeRoutesInAssembly(typeof(HomeAttrController));
for setting up the routing for testing.Should I be doing something like this?
Would this be the best pattern for testing do you think?