0
是否有可能在請求的上下文之外啓動nvelocity路由機制(獨立應用程序或測試框架)並從url中獲取url的動作和路由值?單軌解析URL到路由值
這裏是一個考驗,我需要弄清楚routingMethod:
var url = routingMethod.ResolveAction<MyController>(c=>c.MyAction("Foo",1))
Assert.AreEqual("/MyController/MyAction.rails?name=Foo&amount=1");
var url = "/MyController/MyAction.rails?name=Foo&amount=1";
IDictionary routingValues = routingMethod.DeriveRouteValuesFrom(url);
Assert.AreEqual("MyController", routingValues["controller"]);
Assert.AreEqual("MyAction", routingValues["action"]);
Assert.AreEqual("Foo", routingValues["name"]);
Assert.AreEqual(1, routingValues["amount"]);