Ejemplo n.º 1
0
        public void ValidRouteTests()
        {
            List <string> validRoutes = new List <string>()
            {
                "/",
                "/controller",
                "/a/b/c/d/4/8/4/",
                "/under_score/dash-dash/mix_987-iuFDS",
                "/56/76/32",
                "/:controller/:method/{var}",
                "/dingus/{var}=poophole/{var}/{var}=89",
                "/something/:controller/somethingELSE/:method/something_even_more/another-thing-that-is-here/{var_67#er}",
                "/hello/world/",
                "/:method/{lskdfnvlnweoirn4}/",
                "/{werv435vw3v3rnqoi3rnvoiq3vq 3rvqi3v  3qrv q3 v q3ovi}",
                "/_____________________/------------------------/{var56}/",
                "/something/{var}="
            };

            foreach (string route in validRoutes)
            {
                Console.WriteLine("Testing valid route: " + route);

                SillyRoute sr = new SillyRoute("something", route, "", "");

                Assert.True(sr.IsValid);
            }
        }
Ejemplo n.º 2
0
        public void InvalidRouteTests()
        {
            List <string> validRoutes = new List <string>()
            {
                "",
                " ",
                "something/dingus",
                "/with spaces/dash-dash/mix_987-iuFDS",
                "/kdlope*&",
                "/:moop/:koop/{var}",
                "/something/:controller/somethingELSE/:snatch/something_even_more/another-thing-that-is-here/{var_67#er}",
                "{askldhflaksdhfalksdjf",
                "/:method/lskdfnvlnweoirn4}/",
                "/_____________________/------------------------/stink/12***43/",
                "/:controller/something/:controller",
                "/something/:controller/:method/{var}/{var2}/:method",
                "/hello/{var}89"
            };

            foreach (string route in validRoutes)
            {
                Console.WriteLine("Testing invalid route: " + route);

                SillyRoute sr = new SillyRoute("something", route, "", "");

                Assert.False(sr.IsValid);
            }
        }
Ejemplo n.º 3
0
 public RouteTests()
 {
     route = null;
 }