/// <summary> /// Initializes a new instance of the <see cref="PublishedSnapshot"/> class with a content cache /// and a media cache. /// </summary> public PublishedSnapshot( PublishedContentCache contentCache, PublishedMediaCache mediaCache, PublishedMemberCache memberCache, DomainCache domainCache) { Content = contentCache; Media = mediaCache; Members = memberCache; Domains = domainCache; }
public void SetUp() { TestHelper.SetupLog4NetForTests(); //create the app context ApplicationContext.Current = new ApplicationContext(false); _httpContextFactory = new FakeHttpContextFactory("~/Home"); //ensure the StateHelper is using our custom context StateHelper.HttpContext = _httpContextFactory.HttpContext; UmbracoSettings.UseLegacyXmlSchema = false; var cache = new PublishedContentCache { GetXmlDelegate = (context, preview) => { var doc = new XmlDocument(); doc.LoadXml(GetXml()); return doc; } }; _umbracoContext = new UmbracoContext( _httpContextFactory.HttpContext, ApplicationContext.Current, new PublishedCaches(cache, new PublishedMediaCache())); _cache = _umbracoContext.ContentCache; }
protected UmbracoContext GetUmbracoContext(string url, int templateId, RouteData routeData = null, bool setSingleton = false) { var cache = new PublishedContentCache(); cache.GetXmlDelegate = (context, preview) => { var doc = new XmlDocument(); doc.LoadXml(GetXmlContent(templateId)); return doc; }; PublishedContentCache.UnitTesting = true; var ctx = new UmbracoContext( GetHttpContextFactory(url, routeData).HttpContext, ApplicationContext, new PublishedCaches(cache, new PublishedMediaCache())); if (setSingleton) { UmbracoContext.Current = ctx; } return ctx; }
public override void Initialize() { base.Initialize(); _httpContextFactory = new FakeHttpContextFactory("~/Home"); //ensure the StateHelper is using our custom context StateHelper.HttpContext = _httpContextFactory.HttpContext; UmbracoSettings.UseLegacyXmlSchema = false; _xml = new XmlDocument(); _xml.LoadXml(GetXml()); var cache = new PublishedContentCache { GetXmlDelegate = (context, preview) => _xml }; _umbracoContext = new UmbracoContext( _httpContextFactory.HttpContext, ApplicationContext.Current, new PublishedCaches(cache, new PublishedMediaCache())); _cache = _umbracoContext.ContentCache; }
public override void Initialize() { base.Initialize(); _httpContextFactory = new FakeHttpContextFactory("~/Home"); //ensure the StateHelper is using our custom context StateHelper.HttpContext = _httpContextFactory.HttpContext; var settings = SettingsForTests.GetMockSettings(); var contentMock = Mock.Get(settings.Content); contentMock.Setup(x => x.UseLegacyXmlSchema).Returns(false); SettingsForTests.ConfigureSettings(settings); _xml = new XmlDocument(); _xml.LoadXml(GetXml()); var cache = new PublishedContentCache { GetXmlDelegate = (context, preview) => _xml }; _umbracoContext = new UmbracoContext( _httpContextFactory.HttpContext, ApplicationContext.Current, new PublishedCaches(cache, new PublishedMediaCache()), new WebSecurity(_httpContextFactory.HttpContext, ApplicationContext.Current)); _cache = _umbracoContext.ContentCache; }