Anatoliy
Anatoliy

Reputation: 682

Test routing contstraints via TestHelper

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?

Upvotes: 0

Views: 69

Answers (1)

olix20
olix20

Reputation: 804

"~/Companies/df".ShouldBeIgnored();

Upvotes: 0

Related Questions