예제 #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");
        }
예제 #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
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
		}
예제 #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);
		}
예제 #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");
		}
예제 #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 
		}