public void PostMapRequestHandlerNoPath() { var m = new UrlRoutingModule(); RouteTable.Routes.Add(new MyRoute("foo/bar", new MyRouteHandler())); // ... huh? no NIE? what does it do then? m.PostMapRequestHandler(new HttpContextStub2("~/foo/bar", null)); }
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); }
public void Pipeline3() { var m = new UrlRoutingModule(); RouteTable.Routes.Add(new MyRoute("{foo}/{bar}", new MyRouteHandler())); var hc = new HttpContextStub2("~/x/y", String.Empty, "apppath"); hc.SetResponse(new HttpResponseStub(2)); Assert.IsNotNull(m.RouteCollection.GetRouteData(hc), "#0"); m.PostResolveRequestCache(hc); try { m.PostMapRequestHandler(hc); Assert.Fail("#1"); } catch (ApplicationException ex) { Assert.AreEqual("~/UrlRouting.axd", ex.Message, "#2"); } }
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); }