本文整理汇总了C#中Routing.FindRoute方法的典型用法代码示例。如果您正苦于以下问题:C# Routing.FindRoute方法的具体用法?C# Routing.FindRoute怎么用?C# Routing.FindRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Routing
的用法示例。
在下文中一共展示了Routing.FindRoute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindRoute_ThrowsAnExcpetionWhenNotRoutesMatched
public void FindRoute_ThrowsAnExcpetionWhenNotRoutesMatched()
{
var routing = new Routing();
routing.RegisterRoute(_simpleRoute);
var matchedRoute = routing.FindRoute("ls", new Dictionary<string, string>() { { "path", @"c:\temp\" } });
}
示例2: FindRoute_CanFindASimpleRoute
public void FindRoute_CanFindASimpleRoute()
{
var routing = new Routing();
routing.RegisterRoute(_simpleRoute);
var matchedRoute = routing.FindRoute("ls", new Dictionary<string, string>());
Assert.AreEqual(_simpleRoute, matchedRoute);
}
示例3: FindRoute_CanFindARouteWithDashInName
public void FindRoute_CanFindARouteWithDashInName()
{
var routing = new Routing();
routing.RegisterRoute("import-keys", new Dictionary<string, ParameterType>() { { "path", ParameterType.Required } }, (p, c, s) => { }, "");
var matchedRoute = routing.FindRoute("import-keys", new Dictionary<string, string>() { { "path", @"c:\temp\" } });
Assert.AreEqual("import-keys", matchedRoute.Name);
}
示例4: FindRoute_CanFindARouteWithARequiredParam
public void FindRoute_CanFindARouteWithARequiredParam()
{
var routing = new Routing();
routing.RegisterRoute(_simpleRoute);
routing.RegisterRoute(_singleParamRoute);
var matchedRoute = routing.FindRoute("ls", new Dictionary<string, string>() { { "path", @"c:\temp\" } });
Assert.AreEqual(_singleParamRoute, matchedRoute);
}