Exemplo n.º 1
0
        public void PostResolveRequestCacheStopRoutingHttpHandler()
        {
            var m = new UrlRoutingModule();

            RouteTable.Routes.Add(new MyRoute("foo/bar", new StopRoutingHandler()));
            var hc = new HttpContextStub3("~/foo/bar", String.Empty, "apppath", false);

            m.PostResolveRequestCache(hc);
            Assert.IsNull(hc.RewrittenPath, "StopRoutingHandler should stop before the path is rewritten");
        }
Exemplo n.º 2
0
        public void PostResolveRequestCache()
        {
            var m = new UrlRoutingModule();

            RouteTable.Routes.Add(new MyRoute("{foo}/{bar}", new MyRouteHandler()));
            var hc = new HttpContextStub3("~/x/y", "z", "apppath", false);

            hc.SetResponse(new HttpResponseStub(2));
            m.PostResolveRequestCache(hc);
            Assert.AreEqual("~/UrlRouting.axd", hc.RewrittenPath, "#1");
            // it internally stores the handler
        }
Exemplo n.º 3
0
        public void Pipeline1()
        {
            var m = new UrlRoutingModule();

            RouteTable.Routes.Add(new MyRoute("{foo}/{bar}", new MyRouteHandler()));
            var hc = new HttpContextStub3("~/x/y", "z", "apppath", false);

            hc.SetResponse(new HttpResponseStub(2));
            m.PostResolveRequestCache(hc);
            Assert.AreEqual("~/UrlRouting.axd", hc.RewrittenPath, "#1");
            // It tries to set Handler and causes NIE
            m.PostMapRequestHandler(hc);
        }
Exemplo n.º 4
0
        public void Pipeline2()
        {
            var m = new UrlRoutingModule();

            RouteTable.Routes.Add(new MyRoute("{foo}/{bar}", new MyRouteHandler()));
#if NET_4_0
            var hc = new HttpContextStub4("~/x/y", "z", "apppath", true);
#else
            var hc = new HttpContextStub3("~/x/y", "z", "apppath", true);
#endif
            hc.HttpHandler = new MyHttpHandler();
            hc.SetResponse(new HttpResponseStub(2));
            m.PostResolveRequestCache(hc);
#if NET_4_0
            Assert.AreEqual(null, hc.RewrittenPath, "#1");
#else
            Assert.AreEqual("~/UrlRouting.axd", hc.RewrittenPath, "#1");
#endif
            // It tries to set Handler and causes NIE
            m.PostMapRequestHandler(hc);
        }
Exemplo n.º 5
0
		public void Pipeline2 ()
		{
			var m = new UrlRoutingModule ();
			RouteTable.Routes.Add (new MyRoute ("{foo}/{bar}", new MyRouteHandler ()));
#if NET_4_0
			var hc = new HttpContextStub4 ("~/x/y", "z", "apppath", true);
#else
			var hc = new HttpContextStub3 ("~/x/y", "z", "apppath", true);
#endif
			hc.HttpHandler = new MyHttpHandler ();
			hc.SetResponse (new HttpResponseStub (2));
			m.PostResolveRequestCache (hc);
#if NET_4_0
			Assert.AreEqual (null, hc.RewrittenPath, "#1");
#else
			Assert.AreEqual ("~/UrlRouting.axd", hc.RewrittenPath, "#1");
#endif
			// It tries to set Handler and causes NIE
			m.PostMapRequestHandler (hc);
		}
Exemplo n.º 6
0
		public void Pipeline1 ()
		{
			var m = new UrlRoutingModule ();
			RouteTable.Routes.Add (new MyRoute ("{foo}/{bar}", new MyRouteHandler ()));
			var hc = new HttpContextStub3 ("~/x/y", "z", "apppath", false);
			hc.SetResponse (new HttpResponseStub (2));
			m.PostResolveRequestCache (hc);
			Assert.AreEqual ("~/UrlRouting.axd", hc.RewrittenPath, "#1");
			// It tries to set Handler and causes NIE
			m.PostMapRequestHandler (hc);
		}
Exemplo n.º 7
0
		public void PostResolveRequestCacheStopRoutingHttpHandler ()
		{
			var m = new UrlRoutingModule ();
			RouteTable.Routes.Add (new MyRoute ("foo/bar", new StopRoutingHandler ()));
			var hc = new HttpContextStub3 ("~/foo/bar", String.Empty, "apppath", false);
			m.PostResolveRequestCache (hc);
			Assert.IsNull (hc.RewrittenPath, "StopRoutingHandler should stop before the path is rewritten");
		}
Exemplo n.º 8
0
		public void PostResolveRequestCache ()
		{
			var m = new UrlRoutingModule ();
			RouteTable.Routes.Add (new MyRoute ("{foo}/{bar}", new MyRouteHandler ()));
#if NET_4_0
			var hc = new HttpContextStub4 ("~/x/y", "z", "apppath", false);
#else
			var hc = new HttpContextStub3 ("~/x/y", "z", "apppath", false);
#endif
			hc.SetResponse (new HttpResponseStub (2));
			m.PostResolveRequestCache (hc);
#if NET_4_0
			Assert.AreEqual (null, hc.RewrittenPath, "#1");
#else
			Assert.AreEqual ("~/UrlRouting.axd", hc.RewrittenPath, "#1");
#endif
			// it internally stores the handler 
		}