Esempio n. 1
0
        public void Should_Ignore_Routes_Correctly()
        {
            var descriptor = new SampleWebModuleDescriptor();
            var context    = new WebModuleRegistrationContext(descriptor);

            context.IgnoreRoute("url1");
            context.IgnoreRoute("url2", new { Constraint = "Constraint" });

            Assert.AreEqual(context.Routes.Count, 2);

            var route1 = (Route)context.Routes[0];

            Assert.AreEqual(route1.Url, "url1");
            Assert.IsEmpty(route1.Constraints);
            Assert.IsTrue(route1.RouteHandler is StopRoutingHandler);

            var route2 = (Route)context.Routes[1];

            Assert.AreEqual(route2.Url, "url2");
            Assert.IsNotEmpty(route2.Constraints);
            Assert.IsTrue(route2.RouteHandler is StopRoutingHandler);
        }
Esempio n. 2
0
 /// <summary>
 /// Registers module custom routes.
 /// </summary>
 /// <param name="context">The area registration context.</param>
 /// <param name="containerBuilder">The container builder.</param>
 public override void RegisterCustomRoutes(WebModuleRegistrationContext context, ContainerBuilder containerBuilder)
 {
     context.IgnoreRoute("bcms-api/{*pathInfo}");
 }