public UriRouteMapper(UriRoute route, Func<IOwinContext, bool> filter = null) { Contract.Assert(route != null); _filter = filter ?? (_ => true); _route = route; _parts = Parse(route.Template).ToList(); }
public void Parse_NoParams(string uriString, string template) { var uri = new Uri(uriString); var route = new UriRoute(new Uri(uri.Scheme + Uri.SchemeDelimiter + uri.Host + (uri.Port > 0 ? (":" + uri.Port) : null)), template); var parser = new UriRouteMapper(route); Assert.That(parser.CanMap(uri)); var parameters = parser.Parse(uri); }
public void ParseWildCards() { var uri = new Uri("http://hosty/wild/man"); var template = "/*/man"; var route = new UriRoute(new Uri(uri.Scheme + Uri.SchemeDelimiter + uri.Host + (uri.Port > 0 ? (":" + uri.Port) : null)), template); var parser = new UriRouteMapper(route); Assert.That(parser.CanMap(uri)); var parameters = parser.Parse(uri); Assert.That(parameters["wild"] == "wild"); }