public void WillDelegateContentMappedToHandler() { var module = new RequestReduceModule(); var handler = new DefaultHttpHandler(); var config = new Mock <IRRConfiguration>(); config.Setup(x => x.ResourceAbsolutePath).Returns("/RRContent"); var context = new Mock <HttpContextBase>(); context.Setup(x => x.Request.Url).Returns(new Uri("http://host/content/someresource.less")); context.Setup(x => x.Request.Headers).Returns(new NameValueCollection()); context.Setup(x => x.Server).Returns(new Mock <HttpServerUtilityBase>().Object); context.Setup(x => x.Items).Returns(new Hashtable()); var handlerFactory = new HandlerFactory(config.Object, new UriBuilder(config.Object)); handlerFactory.AddHandlerMap((x, y) => x.AbsolutePath.EndsWith(".less") ? handler : null); handlerFactory.AddHandlerMap((x, y) => x.AbsolutePath.EndsWith(".les") ? new DefaultHttpHandler() : null); RRContainer.Current = new Container(x => { x.For <IRRConfiguration>().Use(config.Object); x.For <IUriBuilder>().Use <UriBuilder>(); x.For <IHandlerFactory>().Use(handlerFactory); }); module.HandleRRContent(context.Object, false); Assert.Equal(handler, context.Object.Items["remapped handler"]); RRContainer.Current = null; }