Exemplo n.º 1
0
        public void SinglePatternRoute_Matches()
        {
            var routes = new RoutesCollection();
            var route = new PatternRoute("/a/:b/c");
            routes.Add(route);

            var match = routes.Match("/a/b/c");

            Assert.That(match.Route, Is.SameAs(route));
        }
Exemplo n.º 2
0
        public void TwoPatternsThatMatch_MatchesTheOneWithHigherScore()
        {
            var routes = new RoutesCollection();
            var route1 = new PatternRoute("/a/:b/c");
            var route2 = new PatternRoute("/a/:b/:c");
            routes.Add(route1);
            routes.Add(route2);

            var match = routes.Match("/a/b/c");

            Assert.That(match.Route, Is.SameAs(route1));
        }
Exemplo n.º 3
0
        public void TwoExacts_MatchesTheCorrectOne()
        {
            var routes = new RoutesCollection();
            var route1 = new ExactMatchRoute("/a/b/c");
            var route2 = new ExactMatchRoute("/a/b/c/d");
            routes.Add(route1);
            routes.Add(route2);

            var match = routes.Match("/a/b/c");

            Assert.That(match.Route, Is.SameAs(route1));
        }
Exemplo n.º 4
0
        public void ExactAndPatternsThatMatch_MatchesTheExact()
        {
            var routes = new RoutesCollection();
            var route1 = new ExactMatchRoute("/a/b/c");
            var route2 = new PatternRoute("/a/:b/c");
            routes.Add(route1);
            routes.Add(route2);

            var match = routes.Match("/a/b/c");

            Assert.That(match.Route, Is.SameAs(route1));
        }