Exemplo n.º 1
0
        public UriRouteMapper(UriRoute route, Func<IOwinContext, bool> filter = null)
        {
            Contract.Assert(route != null);

            _filter = filter ?? (_ => true);
            _route = route;
            _parts = Parse(route.Template).ToList();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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");
        }