public void ShouldIgnoreOptionalParameterButMatchOthers() { PatternRoute route = new PatternRoute("/<controller>/[action]"); Assert.AreEqual("/home", route.CreateUrl(DictHelper.Create("controller=home"))); }
public void ShouldMatchHiphensAndUnderlines() { var route = new PatternRoute("/some/path_to-this"); var match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/some/path_to-this", CreateGetContext(), match)); }
public void ShouldMatchStatic() { var route = new PatternRoute("/some/path"); var match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/some/path", CreateGetContext(), match)); }
public void ShouldMatchNamedRequiredParametersWithExtension() { PatternRoute route = new PatternRoute("/some/<controller>.castle/<action>"); Assert.AreEqual("/some/home.castle/index", route.CreateUrl(DictHelper.Create("controller=home", "action=index"))); }
public void ShouldMatchNamedRequiredParametersWithExtension() { var route = new PatternRoute("/some/<controller>.castle/<action>"); Assert.AreEqual("/some/home.castle/index", route.CreateUrl(DictHelper.Create("controller=home", "action=index"))); }
public void ShouldIgnoreOptionalParameterButMatchOthers() { var route = new PatternRoute("/<controller>/[action]"); Assert.AreEqual("/home", route.CreateUrl(DictHelper.Create("controller=home"))); }
public void ShouldMatchStaticWithFileExtension() { var route = new PatternRoute("/default.aspx"); var match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/default.aspx", CreateGetContext(), match)); }
public void ShouldSkipIfDifferentParameterWasPassed() { var route = new PatternRoute("/some/<controller>"); Assert.IsNull(route.CreateUrl(DictHelper.Create("project=MR"))); Assert.IsNull(route.CreateUrl(DictHelper.Create("controller=home", "project=MR"))); }
public static void Add <T>(this RoutingEngine engine) where T : class, IController { string name = typeof(T).Name.Replace("Controller", string.Empty); var controllerDetails = typeof(T).GetCustomAttributes(typeof(ControllerDetailsAttribute), true).FirstOrDefault() as ControllerDetailsAttribute; string area = string.Empty; if (controllerDetails != null) { area = controllerDetails.Area; } PatternRoute patternIdRoute = new PatternRoute(string.Format("{1}/{0}/<id>/<action>", name, string.IsNullOrEmpty(area) ? string.Empty : string.Format("/{0}", area))) .DefaultForController().Is <T>() .Restrict("id").ValidInteger .DefaultForAction().Is("index"); PatternRoute patternRoute = new PatternRoute(string.Format("{1}/{0}/<action>", name, string.IsNullOrEmpty(area) ? string.Empty : string.Format("/{0}", area))) .DefaultForController().Is <T>() .DefaultForAction().Is("index"); if (!string.IsNullOrEmpty(area)) { patternIdRoute.DefaultForArea().Is(area); patternRoute.DefaultForArea().Is(area); } engine.Add(patternIdRoute); engine.Add(patternRoute); }
public void NamedRequiredParameters() { PatternRoute route = new PatternRoute("/<controller>/<action>"); RouteMatch match = new RouteMatch(); Assert.AreEqual(4000, route.Matches("/some/act", CreateGetContext(), match)); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("act", match.Parameters["action"]); }
public void ShouldReturnZeroForMissingRequiredPart() { var route = new PatternRoute("/<controller>/[action]"); var match = new RouteMatch(); Assert.AreEqual(0, route.Matches("/", CreateGetContext(), match)); }
public void ShouldNotCreateRouteUrlIfDefaultsDoNotMatchAndDefaultDoesNotHaveARestriction() { var route = new PatternRoute("/people/<id>/edit"). DefaultForAction().Is("edit"). DefaultForController().Is("companies"). Restrict("id").ValidInteger; Assert.IsNull(route.CreateUrl(DictHelper.Create("controller=people", "action=edit", "id=1"))); }
public void ShouldMatchSimplesSlash() { PatternRoute route = new PatternRoute("/"); RouteMatch match = new RouteMatch(); Assert.AreEqual(1, route.Matches("/", CreateGetContext(), match)); Assert.AreEqual(1, route.Matches("", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("some", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/some", CreateGetContext(), match)); }
public void ShouldCreateRouteUrlIfDefaultsAreNotSupplied() { var route = new PatternRoute("/people/<id>/edit"). DefaultForAction().Is("edit"). DefaultForController().Is("people"). Restrict("id").ValidInteger; Assert.AreEqual("/people/1/edit", route.CreateUrl(DictHelper.Create("id=1"))); }
public void NamedRequiredParametersForExtension() { var route = new PatternRoute("/<controller>/<action>.<format>"); var match = new RouteMatch(); Assert.AreEqual(6000, route.Matches("/some/act.xml", CreateGetContext(), match)); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("act", match.Parameters["action"]); Assert.AreEqual("xml", match.Parameters["format"]); }
public void ShouldMatchWhenRestrictingWithMatchingMultipleVerb() { var route = new PatternRoute("/simple") .RestrictTo(Verb.Get | Verb.Post); var match = new RouteMatch(); Assert.Less(0, route.Matches("/simple", CreateGetContext(), match)); }
public void ShouldNotMatchWhenRestrictingMultipleVerbs() { var route = new PatternRoute("/simple") .RestrictTo(Verb.Post | Verb.Put); var match = new RouteMatch(); Assert.AreEqual(0, route.Matches("/simple", CreateGetContext(), match)); }
public void NamedRequiredParameters() { var route = new PatternRoute("/<controller>/<action>"); var match = new RouteMatch(); Assert.AreEqual(4000, route.Matches("/some/act", CreateGetContext(), match)); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("act", match.Parameters["action"]); }
public void NamedParametersCanHaveUnderlines() { var route = new PatternRoute("/<controller>/<action>"); var match = new RouteMatch(); route.Matches("/some/act_name", CreateGetContext(), match); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("act_name", match.Parameters["action"]); }
public void ShouldOmitOptionalParameterIfMatchesWithDefault() { var route = new PatternRoute("/projects/<project>/<controller>/[action]/[id]"). DefaultFor("action").Is("index"). Restrict("controller").AnyOf("stories", "bugs", "tasks"). Restrict("id").ValidInteger; Assert.AreEqual("/projects/MonoRail/bugs", route.CreateUrl(DictHelper.Create("project=MonoRail", "controller=bugs", "action=index"))); }
public void ShouldMatchSimplesSlash() { var route = new PatternRoute("/"); var match = new RouteMatch(); Assert.AreEqual(1, route.Matches("/", CreateGetContext(), match)); Assert.AreEqual(1, route.Matches("", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("some", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/some", CreateGetContext(), match)); }
public void ShouldMatchEmptyUrl() { var route = new PatternRoute("/[controller]/[action]"); var match = new RouteMatch(); Assert.AreEqual(2, route.Matches("", CreateGetContext(), match)); Assert.IsTrue(match.Parameters.ContainsKey("controller")); Assert.IsTrue(match.Parameters.ContainsKey("action")); }
public void ShouldReturnNonZeroForMatchedDefaults() { var route = new PatternRoute("/[controller]/[action]"); var match = new RouteMatch(); Assert.AreEqual(2, route.Matches("/", CreateGetContext(), match)); Assert.IsTrue(match.Parameters.ContainsKey("controller")); Assert.IsTrue(match.Parameters.ContainsKey("action")); }
public void ShouldMatchStaticCaseInsensitive() { PatternRoute route = new PatternRoute("/default.aspx"); RouteMatch match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/DEFAULT.ASPX", CreateGetContext(), match)); route = new PatternRoute("/some/path"); match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/SOME/Path", CreateGetContext(), match)); }
public void ShouldCreateRouteUrlIfDefaultsDoNotMatchAndDefaultsHaveRestrictions() { var route = new PatternRoute("/people/<id>/edit.[format]"). DefaultForAction().Is("edit"). DefaultForController().Is("people"). Restrict("id").ValidInteger. Restrict("format").AnyOf(new[] { "html", "json", "xml" }). DefaultFor("format").Is("html"); Assert.AreEqual("/people/1/edit.json", route.CreateUrl(DictHelper.Create("id=1", "format=json"))); }
public void ShouldNotLeaveATrailingSlash() { var route = new PatternRoute("/people/<id>/edit.[format]/"). DefaultForAction().Is("edit"). DefaultForController().Is("people"). Restrict("id").ValidInteger. Restrict("format").AnyOf(new[] { "html", "json", "xml" }). DefaultFor("format").Is("html"); Assert.AreEqual("/people/1/edit", route.CreateUrl(DictHelper.Create("id=1"))); }
public void NamedOptionalParametersWithDefaults() { var route = new PatternRoute("/<controller>/[action]/[id]") .DefaultFor("action").Is("index").DefaultFor("id").Is("0"); var match = new RouteMatch(); Assert.AreEqual(2002, route.Matches("/some", CreateGetContext(), match)); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("index", match.Parameters["action"]); Assert.AreEqual("0", match.Parameters["id"]); }
public Tourist(TourisType type, string _id, float _speed, PatternRoute _pattern, RestPlaceController _restPlace, int _perfectReward) { id = _id; speed = _speed; pattern = _pattern; state = TouristState.None; routeState = TouristRouteState.None; stunned = false; restPlace = _restPlace; perfectReward = _perfectReward; }
public void ShouldMatchStaticCaseInsensitive() { var route = new PatternRoute("/default.aspx"); var match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/DEFAULT.ASPX", CreateGetContext(), match)); route = new PatternRoute("/some/path"); match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/SOME/Path", CreateGetContext(), match)); }
public Enemy(string _id, int _health, float _speed, PatternRoute _route, RestPlaceController _target, int rewards) { id = _id; health = _health; currentHealth = _health; speed = _speed; target = _target; pattern = _route; state = EnemyState.Alive; action = EnemyAction.None; rewardBeforeStunt = rewards; }
public void ShouldMatchNamedRequiredParameter() { PatternRoute route = new PatternRoute("/some/<controller>"); Assert.AreEqual("/some/home", route.CreateUrl(DictHelper.Create("controller=home"))); Assert.AreEqual("/some/home", route.CreateUrl(standardRouteParamsWithoutArea)); Assert.IsNull(route.CreateUrl(standardRouteParamsWithArea)); route = new PatternRoute("/some/<controller>/<action>"); Assert.AreEqual("/some/home/index", route.CreateUrl(DictHelper.Create("controller=home", "action=index"))); Assert.AreEqual("/some/home/index", route.CreateUrl(standardRouteParamsWithoutArea)); Assert.IsNull(route.CreateUrl(standardRouteParamsWithArea)); }
public void ShouldMatchNamedRequiredParameter() { var route = new PatternRoute("/some/<controller>"); Assert.AreEqual("/some/home", route.CreateUrl(DictHelper.Create("controller=home"))); Assert.AreEqual("/some/home", route.CreateUrl(standardRouteParamsWithoutArea)); Assert.IsNull(route.CreateUrl(standardRouteParamsWithArea)); route = new PatternRoute("/some/<controller>/<action>"); Assert.AreEqual("/some/home/index", route.CreateUrl(DictHelper.Create("controller=home", "action=index"))); Assert.AreEqual("/some/home/index", route.CreateUrl(standardRouteParamsWithoutArea)); Assert.IsNull(route.CreateUrl(standardRouteParamsWithArea)); }
public void AnythingBut_Restriction() { var route = new PatternRoute("/<controller>/[action]/[id]") .Restrict("controller").AnythingBut("dummy") .Restrict("id").ValidInteger; var match = new RouteMatch(); Assert.AreEqual(0, route.Matches("/dummy/index", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/DUMMY/list", CreateGetContext(), match)); Assert.AreEqual(4001, route.Matches("/some/new", CreateGetContext(), match)); Assert.AreEqual(6000, route.Matches("/some/list/1", CreateGetContext(), match)); }
public void NamedOptionalParametersWithRestrictions() { var route = new PatternRoute("/<controller>/[action]/[id]") .Restrict("action").AnyOf("index", "list") .Restrict("id").ValidInteger; var match = new RouteMatch(); Assert.AreEqual(4001, route.Matches("/some/index", CreateGetContext(), match)); Assert.AreEqual(4001, route.Matches("/some/list", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/some/new", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/some/index/foo", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/some/list/bar", CreateGetContext(), match)); Assert.AreEqual(6000, route.Matches("/some/list/1", CreateGetContext(), match)); }
public void NamedOptionalParameters() { var route = new PatternRoute("/<controller>/[action]/[id]"); var match = new RouteMatch(); Assert.AreEqual(4001, route.Matches("/some/act", CreateGetContext(), match)); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("act", match.Parameters["action"]); match = new RouteMatch(); Assert.AreEqual(6000, route.Matches("/some/act/10", CreateGetContext(), match)); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("act", match.Parameters["action"]); Assert.AreEqual("10", match.Parameters["id"]); }
public void ShouldApplyRestrictionsToParameters() { var route = new PatternRoute("/projects/<project>/<controller>/[action]/[id]"). DefaultFor("action").Is("index"). Restrict("controller").AnyOf("stories", "bugs", "tasks"). Restrict("id").ValidInteger; Assert.IsNull( route.CreateUrl(DictHelper.Create("project=MonoRail", "controller=home"))); Assert.AreEqual("/projects/MonoRail/Stories", route.CreateUrl(DictHelper.Create("project=MonoRail", "controller=Stories"))); Assert.AreEqual("/projects/MonoRail/bugs", route.CreateUrl(DictHelper.Create("project=MonoRail", "controller=bugs", "action=index"))); }
public void NamedRequiredParametersWithRestrictions() { var matchGuid = "[A-Fa-f0-9]{32}|" + "({|\\()?[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}(}|\\))?|" + "({)?[0xA-Fa-f0-9]{3,10}(, {0,1}[0xA-Fa-f0-9]{3,6}){2}, {0,1}({)([0xA-Fa-f0-9]{3,4}, {0,1}){7}[0xA-Fa-f0-9]{3,4}(}})"; var route = new PatternRoute("/<param>/<key>") .Restrict("key").ValidRegex(matchGuid); var match = new RouteMatch(); Assert.AreEqual(0, route.Matches("/something/zzzzzzzz-c123-11dc-95ff-0800200c9a66", CreateGetContext(), match)); Assert.AreEqual(4000, route.Matches("/something/173e0970-c123-11dc-95ff-0800200c9a66", CreateGetContext(), match)); Assert.AreEqual("something", match.Parameters["param"]); Assert.AreEqual("173e0970-c123-11dc-95ff-0800200c9a66", match.Parameters["key"]); }
public void AnythingBut_Restriction() { PatternRoute route = new PatternRoute("/<controller>/[action]/[id]") .Restrict("controller").AnythingBut("dummy") .Restrict("id").ValidInteger; RouteMatch match = new RouteMatch(); Assert.AreEqual(0, route.Matches("/dummy/index", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/DUMMY/list", CreateGetContext(), match)); Assert.AreEqual(4001, route.Matches("/some/new", CreateGetContext(), match)); Assert.AreEqual(6000, route.Matches("/some/list/1", CreateGetContext(), match)); }
public void NamedRequiredParametersWithRestrictions() { string matchGuid = "[A-Fa-f0-9]{32}|" + "({|\\()?[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}(}|\\))?|" + "({)?[0xA-Fa-f0-9]{3,10}(, {0,1}[0xA-Fa-f0-9]{3,6}){2}, {0,1}({)([0xA-Fa-f0-9]{3,4}, {0,1}){7}[0xA-Fa-f0-9]{3,4}(}})"; PatternRoute route = new PatternRoute("/<param>/<key>") .Restrict("key").ValidRegex(matchGuid); RouteMatch match = new RouteMatch(); Assert.AreEqual(0, route.Matches("/something/zzzzzzzz-c123-11dc-95ff-0800200c9a66", CreateGetContext(), match)); Assert.AreEqual(4000, route.Matches("/something/173e0970-c123-11dc-95ff-0800200c9a66", CreateGetContext(), match)); Assert.AreEqual("something", match.Parameters["param"]); Assert.AreEqual("173e0970-c123-11dc-95ff-0800200c9a66", match.Parameters["key"]); }
public void NamedOptionalParametersWithRestrictions() { PatternRoute route = new PatternRoute("/<controller>/[action]/[id]") .Restrict("action").AnyOf("index", "list") .Restrict("id").ValidInteger; RouteMatch match = new RouteMatch(); Assert.AreEqual(4001, route.Matches("/some/index", CreateGetContext(), match)); Assert.AreEqual(4001, route.Matches("/some/list", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/some/new", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/some/index/foo", CreateGetContext(), match)); Assert.AreEqual(0, route.Matches("/some/list/bar", CreateGetContext(), match)); Assert.AreEqual(6000, route.Matches("/some/list/1", CreateGetContext(), match)); }
public void NamedOptionalParametersWithDefaults() { PatternRoute route = new PatternRoute("/<controller>/[action]/[id]") .DefaultFor("action").Is("index").DefaultFor("id").Is("0"); RouteMatch match = new RouteMatch(); Assert.AreEqual(2002, route.Matches("/some", CreateGetContext(), match)); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("index", match.Parameters["action"]); Assert.AreEqual("0", match.Parameters["id"]); }
public void ShouldCreateRouteUrlIfDefaultsAreNotSupplied() { PatternRoute route = new PatternRoute("/people/<id>/edit"). DefaultForAction().Is("edit"). DefaultForController().Is("people"). Restrict("id").ValidInteger; Assert.AreEqual("/people/1/edit", route.CreateUrl(DictHelper.Create("id=1"))); }
public void ShouldMatchStatic() { PatternRoute route = new PatternRoute("/some/path"); RouteMatch match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/some/path", CreateGetContext(), match)); }
public void ShouldReturnZeroForMissingRequiredPart() { PatternRoute route = new PatternRoute("/<controller>/[action]"); RouteMatch match = new RouteMatch(); Assert.AreEqual(0, route.Matches("/", CreateGetContext(), match)); }
public void ShouldSkipIfDifferentParameterWasPassed() { PatternRoute route = new PatternRoute("/some/<controller>"); Assert.IsNull(route.CreateUrl(DictHelper.Create("project=MR"))); Assert.IsNull(route.CreateUrl(DictHelper.Create("controller=home", "project=MR"))); }
public void ShouldNotCreateRouteUrlIfDefaultsDoNotMatchAndDefaultDoesNotHaveARestriction() { PatternRoute route = new PatternRoute("/people/<id>/edit"). DefaultForAction().Is("edit"). DefaultForController().Is("companies"). Restrict("id").ValidInteger; Assert.IsNull(route.CreateUrl(DictHelper.Create("controller=people", "action=edit", "id=1"))); }
public void ShouldNotMatchIfParameterIsNotPresent() { PatternRoute route = new PatternRoute("/some/<controller>"); Assert.IsNull(route.CreateUrl(DictHelper.Create(""))); }
public void ShouldNotMatchStaticRule() { PatternRoute route = new PatternRoute("/some/path"); Assert.IsNull(route.CreateUrl(DictHelper.Create(""))); }
public void ShouldNotLeaveATrailingSlash() { PatternRoute route = new PatternRoute("/people/<id>/edit.[format]/"). DefaultForAction().Is("edit"). DefaultForController().Is("people"). Restrict("id").ValidInteger. Restrict("format").AnyOf(new string[] { "html", "json", "xml" }). DefaultFor("format").Is("html"); Assert.AreEqual("/people/1/edit", route.CreateUrl(DictHelper.Create("id=1"))); }
public void ShouldReturnNonZeroForMatchedDefaults() { PatternRoute route = new PatternRoute("/[controller]/[action]"); RouteMatch match = new RouteMatch(); Assert.AreEqual(2, route.Matches("/", CreateGetContext(), match)); Assert.IsTrue(match.Parameters.ContainsKey("controller")); Assert.IsTrue(match.Parameters.ContainsKey("action")); }
public void ShouldMatchEmptyUrl() { PatternRoute route = new PatternRoute("/[controller]/[action]"); RouteMatch match = new RouteMatch(); Assert.AreEqual(2, route.Matches("", CreateGetContext(), match)); Assert.IsTrue(match.Parameters.ContainsKey("controller")); Assert.IsTrue(match.Parameters.ContainsKey("action")); }
public void ShouldOmitOptionalParameterIfMatchesWithDefault() { PatternRoute route = new PatternRoute("/projects/<project>/<controller>/[action]/[id]"). DefaultFor("action").Is("index"). Restrict("controller").AnyOf("stories", "bugs", "tasks"). Restrict("id").ValidInteger; Assert.AreEqual("/projects/MonoRail/bugs", route.CreateUrl(DictHelper.Create("project=MonoRail", "controller=bugs", "action=index"))); }
public void NamedOptionalParameters() { PatternRoute route = new PatternRoute("/<controller>/[action]/[id]"); RouteMatch match = new RouteMatch(); Assert.AreEqual(4001, route.Matches("/some/act", CreateGetContext(), match)); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("act", match.Parameters["action"]); match = new RouteMatch(); Assert.AreEqual(6000, route.Matches("/some/act/10", CreateGetContext(), match)); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("act", match.Parameters["action"]); Assert.AreEqual("10", match.Parameters["id"]); }
public void ShouldMatchStaticWithFileExtension() { PatternRoute route = new PatternRoute("/default.aspx"); RouteMatch match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/default.aspx", CreateGetContext(), match)); }
public void ShouldCreateRouteUrlIfDefaultsDoNotMatchAndDefaultsHaveRestrictions() { PatternRoute route = new PatternRoute("/people/<id>/edit.[format]"). DefaultForAction().Is("edit"). DefaultForController().Is("people"). Restrict("id").ValidInteger. Restrict("format").AnyOf(new string[]{"html", "json", "xml"}). DefaultFor("format").Is("html"); Assert.AreEqual("/people/1/edit.json", route.CreateUrl(DictHelper.Create("id=1", "format=json"))); }
public void ShouldMatchHiphensAndUnderlines() { PatternRoute route = new PatternRoute("/some/path_to-this"); RouteMatch match = new RouteMatch(); Assert.AreEqual(8000, route.Matches("/some/path_to-this", CreateGetContext(), match)); }
public void NamedParametersCanHaveUnderlines() { PatternRoute route = new PatternRoute("/<controller>/<action>"); RouteMatch match = new RouteMatch(); route.Matches("/some/act_name", CreateGetContext(), match); Assert.AreEqual("some", match.Parameters["controller"]); Assert.AreEqual("act_name", match.Parameters["action"]); }
public void ShouldApplyRestrictionsToParameters() { PatternRoute route = new PatternRoute("/projects/<project>/<controller>/[action]/[id]"). DefaultFor("action").Is("index"). Restrict("controller").AnyOf("stories", "bugs", "tasks"). Restrict("id").ValidInteger; Assert.IsNull( route.CreateUrl(DictHelper.Create("project=MonoRail", "controller=home"))); Assert.AreEqual("/projects/MonoRail/Stories", route.CreateUrl(DictHelper.Create("project=MonoRail", "controller=Stories"))); Assert.AreEqual("/projects/MonoRail/bugs", route.CreateUrl(DictHelper.Create("project=MonoRail", "controller=bugs", "action=index"))); }