Exemple #1
0
        public void MappingRoot()
        {
            var routes = new RouteCollection();

            routes.MapRoot("Patients", "Index");
            Assert.AreEqual("Patients", routes.Root().Values["controller"]);
            Assert.AreEqual("Index", routes.Root().Values["action"]);
        }
        public void RootRouteMatchIsCaseInsensitive()
        {
            var routes = new RouteCollection();
            routes.MapRoot("Patients", "Index");

            var tokenizer = new RoutingBasedUrlTokenizer(routes);
            tokenizer.Context = TestFactory.CreateMockContext("~/");
            var urlInfo = tokenizer.TokenizeUrl("/VDIR", new Uri("http://localhost/VDIR"), true, "/vdir");

            Assert.AreEqual("Patients", urlInfo.Controller);
            Assert.AreEqual("Index", urlInfo.Action);
        }
Exemple #3
0
        public void RootRouteMatchIsCaseInsensitive()
        {
            var routes = new RouteCollection();

            routes.MapRoot("Patients", "Index");

            var tokenizer = new RoutingBasedUrlTokenizer(routes);

            tokenizer.Context = TestFactory.CreateMockContext("~/");
            var urlInfo = tokenizer.TokenizeUrl("/VDIR", new Uri("http://localhost/VDIR"), true, "/vdir");

            Assert.AreEqual("Patients", urlInfo.Controller);
            Assert.AreEqual("Index", urlInfo.Action);
        }
        public void InvalidUrlThrows404()
        {
            var routes = new RouteCollection();
            routes.MapRoot("Patients", "Index");

            var tokenizer = new RoutingBasedUrlTokenizer(routes);
            tokenizer.Context = TestFactory.CreateMockContext("~/Login");

            try
            {
                tokenizer.TokenizeUrl("/Login", new Uri("http://localhost/Login"), true, "/");
                Assert.Fail("Should throw 404");
            }
            catch (HttpException ex)
            {
                Assert.AreEqual(404, ex.GetHttpCode());
            }
        }
Exemple #5
0
        public void InvalidUrlThrows404()
        {
            var routes = new RouteCollection();

            routes.MapRoot("Patients", "Index");

            var tokenizer = new RoutingBasedUrlTokenizer(routes);

            tokenizer.Context = TestFactory.CreateMockContext("~/Login");

            try
            {
                tokenizer.TokenizeUrl("/Login", new Uri("http://localhost/Login"), true, "/");
                Assert.Fail("Should throw 404");
            }
            catch (HttpException ex)
            {
                Assert.AreEqual(404, ex.GetHttpCode());
            }
        }
 public void MappingRoot()
 {
     var routes = new RouteCollection();
     routes.MapRoot("Patients", "Index");
     Assert.AreEqual("Patients", routes.Root().Values["controller"]);
     Assert.AreEqual("Index", routes.Root().Values["action"]);
 }