Introduce IUmbracoContextFactory

This commit is contained in:
Stephan
2019-02-14 12:11:06 +01:00
parent e5142e4915
commit 186e8fc58b
20 changed files with 285 additions and 249 deletions

View File

@@ -135,16 +135,17 @@ namespace Umbraco.Tests.TestHelpers.ControllerTesting
var umbracoContextAccessor = Umbraco.Web.Composing.Current.UmbracoContextAccessor;
var umbCtx = UmbracoContext.EnsureContext(
var umbracoContextFactory = new UmbracoContextFactory(
umbracoContextAccessor,
httpContext,
publishedSnapshotService.Object,
webSecurity.Object,
Mock.Of<IUmbracoSettingsSection>(section => section.WebRouting == Mock.Of<IWebRoutingSection>(routingSection => routingSection.UrlProviderMode == UrlProviderMode.Auto.ToString())),
Enumerable.Empty<IUrlProvider>(),
globalSettings,
new TestVariationContextAccessor(),
true); //replace it
new TestDefaultCultureAccessor(),
Mock.Of<IUmbracoSettingsSection>(section => section.WebRouting == Mock.Of<IWebRoutingSection>(routingSection => routingSection.UrlProviderMode == "Auto")),
globalSettings,
Enumerable.Empty<IUrlProvider>(),
Mock.Of<IUserService>());
var umbCtx = umbracoContextFactory.EnsureUmbracoContext(httpContext).UmbracoContext;
var urlHelper = new Mock<IUrlProvider>();
urlHelper.Setup(provider => provider.GetUrl(It.IsAny<UmbracoContext>(), It.IsAny<IPublishedContent>(), It.IsAny<UrlProviderMode>(), It.IsAny<string>(), It.IsAny<Uri>()))