public override void Initialize() { base.Initialize(); var url = "/test"; var lookup = new Umbraco.Web.Routing.LookupByNiceUrl(); var lookups = new Umbraco.Web.Routing.IPublishedContentLookup[] { lookup }; var t = Template.MakeNew("test", new User(0)); var umbracoContext = GetUmbracoContext(url, t.Id); var contentStore = new DefaultPublishedContentStore(); var niceUrls = new NiceUrlProvider(contentStore, umbracoContext); var routingContext = new RoutingContext( umbracoContext, lookups, new FakeLastChanceLookup(), contentStore, niceUrls); //assign the routing context back to the umbraco context umbracoContext.RoutingContext = routingContext; ////assign the routing context back to the umbraco context //umbracoContext.RoutingContext = routingContext; Umbraco.Web.UmbracoContext.Current = routingContext.UmbracoContext; }