diff --git a/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs b/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs index 6e8835b9a5..c092306473 100644 --- a/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs +++ b/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs @@ -158,7 +158,7 @@ namespace Umbraco.Tests.Cache new TestDefaultCultureAccessor(), TestObjects.GetUmbracoSettings(), TestObjects.GetGlobalSettings(), - Enumerable.Empty(), + new UrlProviderCollection(Enumerable.Empty()), Mock.Of()); // just assert it does not throw diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs index 0f84319976..29fdc27840 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs @@ -116,7 +116,7 @@ namespace Umbraco.Tests.TestHelpers var umbracoSettings = GetUmbracoSettings(); var globalSettings = GetGlobalSettings(); - var urlProviders = Enumerable.Empty(); + var urlProviders = new UrlProviderCollection(Enumerable.Empty()); if (accessor == null) accessor = new TestUmbracoContextAccessor(); diff --git a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs index b41aca21c3..0b76de9879 100644 --- a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs @@ -71,7 +71,7 @@ namespace Umbraco.Tests.Web.Mvc new TestDefaultCultureAccessor(), TestObjects.GetUmbracoSettings(), globalSettings, - Enumerable.Empty(), + new UrlProviderCollection(Enumerable.Empty()), Mock.Of()); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of()); @@ -100,7 +100,7 @@ namespace Umbraco.Tests.Web.Mvc new TestDefaultCultureAccessor(), TestObjects.GetUmbracoSettings(), globalSettings, - Enumerable.Empty(), + new UrlProviderCollection(Enumerable.Empty()), Mock.Of()); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of()); @@ -129,7 +129,7 @@ namespace Umbraco.Tests.Web.Mvc new TestDefaultCultureAccessor(), TestObjects.GetUmbracoSettings(), globalSettings, - Enumerable.Empty(), + new UrlProviderCollection(Enumerable.Empty()), Mock.Of()); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of()); @@ -158,7 +158,7 @@ namespace Umbraco.Tests.Web.Mvc new TestDefaultCultureAccessor(), TestObjects.GetUmbracoSettings(), globalSettings, - Enumerable.Empty(), + new UrlProviderCollection(Enumerable.Empty()), Mock.Of()); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of()); diff --git a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs index 846ee4b7d8..7de2dd1aad 100644 --- a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs @@ -46,7 +46,7 @@ namespace Umbraco.Tests.Web.Mvc new TestDefaultCultureAccessor(), TestObjects.GetUmbracoSettings(), globalSettings, - Enumerable.Empty(), + new UrlProviderCollection(Enumerable.Empty()), Mock.Of()); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of()); @@ -73,7 +73,7 @@ namespace Umbraco.Tests.Web.Mvc new TestDefaultCultureAccessor(), TestObjects.GetUmbracoSettings(), globalSettings, - Enumerable.Empty(), + new UrlProviderCollection(Enumerable.Empty()), Mock.Of()); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of()); @@ -103,7 +103,7 @@ namespace Umbraco.Tests.Web.Mvc new TestDefaultCultureAccessor(), Mock.Of(section => section.WebRouting == Mock.Of(routingSection => routingSection.UrlProviderMode == "Auto")), globalSettings, - Enumerable.Empty(), + new UrlProviderCollection(Enumerable.Empty()), Mock.Of()); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of()); @@ -140,7 +140,7 @@ namespace Umbraco.Tests.Web.Mvc new TestDefaultCultureAccessor(), Mock.Of(section => section.WebRouting == webRoutingSettings), globalSettings, - Enumerable.Empty(), + new UrlProviderCollection(Enumerable.Empty()), Mock.Of()); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of()); diff --git a/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs b/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs index 8a4e3e515b..5e9208faf9 100644 --- a/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs +++ b/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs @@ -104,7 +104,7 @@ namespace Umbraco.Tests.Web new TestDefaultCultureAccessor(), Mock.Of(section => section.WebRouting == Mock.Of(routingSection => routingSection.UrlProviderMode == "Auto")), globalSettings, - new[] { testUrlProvider.Object }, + new UrlProviderCollection(new[] { testUrlProvider.Object }), Mock.Of()); using (var reference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of())) diff --git a/src/Umbraco.Web/UmbracoContextFactory.cs b/src/Umbraco.Web/UmbracoContextFactory.cs index a4acd49f1e..9bb2a79411 100644 --- a/src/Umbraco.Web/UmbracoContextFactory.cs +++ b/src/Umbraco.Web/UmbracoContextFactory.cs @@ -28,13 +28,13 @@ namespace Umbraco.Web private readonly IUmbracoSettingsSection _umbracoSettings; private readonly IGlobalSettings _globalSettings; - private readonly IEnumerable _urlProviders; + private readonly UrlProviderCollection _urlProviders; private readonly IUserService _userService; /// /// Initializes a new instance of the class. /// - public UmbracoContextFactory(IUmbracoContextAccessor umbracoContextAccessor, IPublishedSnapshotService publishedSnapshotService, IVariationContextAccessor variationContextAccessor, IDefaultCultureAccessor defaultCultureAccessor, IUmbracoSettingsSection umbracoSettings, IGlobalSettings globalSettings, IEnumerable urlProviders, IUserService userService) + public UmbracoContextFactory(IUmbracoContextAccessor umbracoContextAccessor, IPublishedSnapshotService publishedSnapshotService, IVariationContextAccessor variationContextAccessor, IDefaultCultureAccessor defaultCultureAccessor, IUmbracoSettingsSection umbracoSettings, IGlobalSettings globalSettings, UrlProviderCollection urlProviders, IUserService userService) { _umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor)); _publishedSnapshotService = publishedSnapshotService ?? throw new ArgumentNullException(nameof(publishedSnapshotService)); @@ -65,7 +65,7 @@ namespace Umbraco.Web if (currentUmbracoContext != null) return new UmbracoContextReference(currentUmbracoContext, false, _umbracoContextAccessor); - + httpContext = httpContext ?? new HttpContextWrapper(HttpContext.Current ?? new HttpContext(new SimpleWorkerRequest("null.aspx", "", NullWriterInstance))); var umbracoContext = CreateUmbracoContext(httpContext);