Cleanup
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
@@ -164,8 +164,7 @@ namespace Umbraco.Tests.Cache
|
||||
TestObjects.GetGlobalSettings(),
|
||||
Mock.Of<IUserService>(),
|
||||
IOHelper,
|
||||
httpContextAccessor,
|
||||
PublishedUrlProvider);
|
||||
httpContextAccessor);
|
||||
|
||||
// just assert it does not throw
|
||||
var refreshers = new DistributedCacheBinder(null, umbracoContextFactory, null);
|
||||
|
||||
@@ -82,8 +82,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
new WebSecurity(httpContextAccessor, Mock.Of<IUserService>(), globalSettings, IOHelper),
|
||||
globalSettings,
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
|
||||
_cache = _umbracoContext.Content;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
new WebSecurity(httpContextAccessor, Current.Services.UserService, globalSettings, IOHelper),
|
||||
globalSettings,
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
|
||||
return umbracoContext;
|
||||
}
|
||||
|
||||
@@ -125,8 +125,7 @@ namespace Umbraco.Tests.Scoping
|
||||
new WebSecurity(httpContextAccessor, Current.Services.UserService, globalSettings, IOHelper),
|
||||
globalSettings,
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
|
||||
if (setSingleton)
|
||||
Umbraco.Web.Composing.Current.UmbracoContextAccessor.UmbracoContext = umbracoContext;
|
||||
|
||||
@@ -36,8 +36,7 @@ namespace Umbraco.Tests.Security
|
||||
Mock.Of<IPublishedSnapshotService>(),
|
||||
new WebSecurity(httpContextAccessor, Current.Services.UserService, globalSettings, IOHelper), globalSettings,
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Install);
|
||||
var mgr = new BackOfficeCookieManager(
|
||||
@@ -59,8 +58,7 @@ namespace Umbraco.Tests.Security
|
||||
new WebSecurity(httpContextAccessor, Current.Services.UserService, globalSettings, IOHelper),
|
||||
globalSettings,
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Run);
|
||||
var mgr = new BackOfficeCookieManager(Mock.Of<IUmbracoContextAccessor>(accessor => accessor.UmbracoContext == umbCtx), runtime, TestObjects.GetGlobalSettings(), IOHelper, AppCaches.RequestCache);
|
||||
|
||||
@@ -143,8 +143,7 @@ namespace Umbraco.Tests.TestHelpers.ControllerTesting
|
||||
webSecurity.Object,
|
||||
globalSettings,
|
||||
new TestVariationContextAccessor(),
|
||||
TestHelper.IOHelper,
|
||||
Mock.Of<IPublishedUrlProvider>());
|
||||
TestHelper.IOHelper);
|
||||
|
||||
//replace it
|
||||
umbracoContextAccessor.UmbracoContext = umbCtx;
|
||||
|
||||
@@ -133,8 +133,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
TestHelper.IOHelper,
|
||||
httpContextAccessor,
|
||||
Mock.Of<IPublishedUrlProvider>());
|
||||
httpContextAccessor);
|
||||
|
||||
return umbracoContextFactory.EnsureUmbracoContext().UmbracoContext;
|
||||
}
|
||||
|
||||
@@ -381,8 +381,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
Factory.GetInstance<IGlobalSettings>(), IOHelper),
|
||||
globalSettings ?? Factory.GetInstance<IGlobalSettings>(),
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
|
||||
if (setSingleton)
|
||||
Umbraco.Web.Composing.Current.UmbracoContextAccessor.UmbracoContext = umbracoContext;
|
||||
|
||||
@@ -44,8 +44,7 @@ namespace Umbraco.Tests.Testing.Objects
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
TestHelper.IOHelper,
|
||||
httpContextAccessor,
|
||||
publishedUrlProvider);
|
||||
httpContextAccessor);
|
||||
|
||||
return umbracoContextFactory;
|
||||
}
|
||||
|
||||
@@ -73,8 +73,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
TestHelper.IOHelper,
|
||||
httpContextAccessor,
|
||||
Mock.Of<IPublishedUrlProvider>());
|
||||
httpContextAccessor);
|
||||
|
||||
var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext();
|
||||
var umbCtx = umbracoContextReference.UmbracoContext;
|
||||
@@ -104,8 +103,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
TestHelper.IOHelper,
|
||||
httpContextAccessor,
|
||||
Mock.Of<IPublishedUrlProvider>());
|
||||
httpContextAccessor);
|
||||
|
||||
var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext();
|
||||
var umbCtx = umbracoContextReference.UmbracoContext;
|
||||
@@ -135,8 +133,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
TestHelper.IOHelper,
|
||||
httpContextAccessor,
|
||||
Mock.Of<IPublishedUrlProvider>());
|
||||
httpContextAccessor);
|
||||
|
||||
var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext();
|
||||
var umbCtx = umbracoContextReference.UmbracoContext;
|
||||
@@ -166,8 +163,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
TestHelper.IOHelper,
|
||||
httpContextAccessor,
|
||||
Mock.Of<IPublishedUrlProvider>());
|
||||
httpContextAccessor);
|
||||
|
||||
var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext();
|
||||
var umbCtx = umbracoContextReference.UmbracoContext;
|
||||
|
||||
@@ -49,8 +49,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
IOHelper,
|
||||
httpContextAccessor,
|
||||
PublishedUrlProvider);
|
||||
httpContextAccessor);
|
||||
|
||||
var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext();
|
||||
var umbracoContext = umbracoContextReference.UmbracoContext;
|
||||
@@ -78,8 +77,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
IOHelper,
|
||||
httpContextAccessor,
|
||||
PublishedUrlProvider);
|
||||
httpContextAccessor);
|
||||
|
||||
var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext();
|
||||
var umbCtx = umbracoContextReference.UmbracoContext;
|
||||
@@ -110,8 +108,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
IOHelper,
|
||||
httpContextAccessor,
|
||||
PublishedUrlProvider);
|
||||
httpContextAccessor);
|
||||
|
||||
var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext();
|
||||
var umbracoContext = umbracoContextReference.UmbracoContext;
|
||||
@@ -149,8 +146,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
globalSettings,
|
||||
Mock.Of<IUserService>(),
|
||||
IOHelper,
|
||||
httpContextAccessor,
|
||||
PublishedUrlProvider);
|
||||
httpContextAccessor);
|
||||
|
||||
var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext();
|
||||
var umbracoContext = umbracoContextReference.UmbracoContext;
|
||||
|
||||
@@ -444,8 +444,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
new WebSecurity(httpContextAccessor, Current.Services.UserService, globalSettings, IOHelper),
|
||||
globalSettings,
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
|
||||
//if (setSingleton)
|
||||
//{
|
||||
|
||||
@@ -35,8 +35,7 @@ namespace Umbraco.Tests.Web
|
||||
new WebSecurity(httpContextAccessor, Current.Services.UserService, TestObjects.GetGlobalSettings(), IOHelper),
|
||||
TestObjects.GetGlobalSettings(),
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
var r1 = new RouteData();
|
||||
r1.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx);
|
||||
|
||||
@@ -55,8 +54,7 @@ namespace Umbraco.Tests.Web
|
||||
new WebSecurity(httpContextAccessor, Current.Services.UserService, TestObjects.GetGlobalSettings(), IOHelper),
|
||||
TestObjects.GetGlobalSettings(),
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
|
||||
var r1 = new RouteData();
|
||||
r1.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx);
|
||||
@@ -85,8 +83,7 @@ namespace Umbraco.Tests.Web
|
||||
new WebSecurity(httpContextAccessor, Current.Services.UserService, TestObjects.GetGlobalSettings(), IOHelper),
|
||||
TestObjects.GetGlobalSettings(),
|
||||
new TestVariationContextAccessor(),
|
||||
IOHelper,
|
||||
PublishedUrlProvider);
|
||||
IOHelper);
|
||||
|
||||
var httpContext = Mock.Of<HttpContextBase>();
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Web.Composing;
|
||||
@@ -21,7 +19,6 @@ namespace Umbraco.Web
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IPublishedUrlProvider _publishedUrlProvider;
|
||||
private readonly Lazy<IPublishedSnapshot> _publishedSnapshot;
|
||||
private string _previewToken;
|
||||
private bool? _previewing;
|
||||
@@ -35,8 +32,7 @@ namespace Umbraco.Web
|
||||
IWebSecurity webSecurity,
|
||||
IGlobalSettings globalSettings,
|
||||
IVariationContextAccessor variationContextAccessor,
|
||||
IIOHelper ioHelper,
|
||||
IPublishedUrlProvider publishedUrlProvider)
|
||||
IIOHelper ioHelper)
|
||||
{
|
||||
if (httpContextAccessor == null) throw new ArgumentNullException(nameof(httpContextAccessor));
|
||||
if (publishedSnapshotService == null) throw new ArgumentNullException(nameof(publishedSnapshotService));
|
||||
@@ -45,7 +41,6 @@ namespace Umbraco.Web
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings));
|
||||
_ioHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper));
|
||||
_publishedUrlProvider = publishedUrlProvider;
|
||||
|
||||
// ensure that this instance is disposed when the request terminates, though we *also* ensure
|
||||
// this happens in the Umbraco module since the UmbracoCOntext is added to the HttpContext items.
|
||||
|
||||
@@ -32,12 +32,11 @@ namespace Umbraco.Web
|
||||
private readonly IUserService _userService;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IPublishedUrlProvider _publishedUrlProvider;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UmbracoContextFactory"/> class.
|
||||
/// </summary>
|
||||
public UmbracoContextFactory(IUmbracoContextAccessor umbracoContextAccessor, IPublishedSnapshotService publishedSnapshotService, IVariationContextAccessor variationContextAccessor, IDefaultCultureAccessor defaultCultureAccessor, IGlobalSettings globalSettings, IUserService userService, IIOHelper ioHelper, IHttpContextAccessor httpContextAccessor, IPublishedUrlProvider publishedUrlProvider)
|
||||
public UmbracoContextFactory(IUmbracoContextAccessor umbracoContextAccessor, IPublishedSnapshotService publishedSnapshotService, IVariationContextAccessor variationContextAccessor, IDefaultCultureAccessor defaultCultureAccessor, IGlobalSettings globalSettings, IUserService userService, IIOHelper ioHelper, IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
|
||||
_publishedSnapshotService = publishedSnapshotService ?? throw new ArgumentNullException(nameof(publishedSnapshotService));
|
||||
@@ -47,7 +46,6 @@ namespace Umbraco.Web
|
||||
_userService = userService ?? throw new ArgumentNullException(nameof(userService));
|
||||
_ioHelper = ioHelper;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_publishedUrlProvider = publishedUrlProvider;
|
||||
}
|
||||
|
||||
private IUmbracoContext CreateUmbracoContext()
|
||||
@@ -66,7 +64,7 @@ namespace Umbraco.Web
|
||||
|
||||
var webSecurity = new WebSecurity(_httpContextAccessor, _userService, _globalSettings, _ioHelper);
|
||||
|
||||
return new UmbracoContext(_httpContextAccessor, _publishedSnapshotService, webSecurity, _globalSettings, _variationContextAccessor, _ioHelper, _publishedUrlProvider);
|
||||
return new UmbracoContext(_httpContextAccessor, _publishedSnapshotService, webSecurity, _globalSettings, _variationContextAccessor, _ioHelper);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user