Test routing contstraints via TestHelper

Go To StackoverFlow.com

0

I have the next routing.

routes.MapRoute("Companies", "Companies/{companyId}",
    new { controller = "Company", action = "Details" },
    new { companyId = @"\d+" });

Here is test which tests it.

"~/Companies/7".ShouldMapTo<CompanyController>(action => action.Details(7));

Now I want to test constraints. So url "~/Companies/df" shouldn't be mapped to the controller.

Does anyone know how to test it?

2012-04-04 18:04
by Anatoliy
possible duplicate of Using MvcContrib TestHelper to assert that an inbound route should not be mappedWouter de Kort 2012-04-04 18:13


0

"~/Companies/df".ShouldBeIgnored();
2012-04-04 18:20
by olix20
Ads