예제 #1
0
        public void AnyRouteTest()
        {
            var router = new Router();
            var root   = RouteTester.Create(router, HTTPMethod.Get, "/*");

            root.Route("", "/", "/abc", "/eee", "/abc/efg");

            var case1 = RouteTester.Create(router, HTTPMethod.Get, "/abcd*");
            var case2 = RouteTester.Create(router, HTTPMethod.Get, "/abcdefgh*");
            var case3 = RouteTester.Create(router, HTTPMethod.Get, "/acc*");
            var case4 = RouteTester.Create(router, HTTPMethod.Get, "/zzz*");

            root.Route("", "/", "/a", "/b");
            root.NotRoute("/abcdefg", "/zzzzzz");

            case1.Route("/abcd", "/abcd/", "/abcdefg", "/abcd/hoge");
            case1.NotRoute("/", "/abc", "/k");

            case2.Route("/abcdefgh", "/abcdefgh/", "/abcdefghijk", "/abcdefghijk/l", "/abcdefgh/ijk");
            case2.NotRoute("/", "/abcdfgh", "/k");

            case3.Route("/acc", "/acc/", "/acckk", "/acc/k");
            case3.NotRoute("/", "/abc", "/abcd");

            case4.Route("/zzz", "/zzz/", "/zzzb");
            case4.NotRoute("/", "/acc", "/abcd");
        }
예제 #2
0
 private static void TestRoute(Router router, HTTPMethod method, string registerPath, params string[] actualPaths)
 => RouteTester.Create(router, method, registerPath).Route(actualPaths);