Merge pull request #7547 from emmagarland/netcore/feature/7369-removeservices-unittests

Unit tests update to replace Current.Service references
This commit is contained in:
Bjarke Berg
2020-02-03 15:51:23 +01:00
committed by GitHub

View File

@@ -4,7 +4,6 @@ using Moq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Web.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Services;
@@ -66,11 +65,11 @@ namespace Umbraco.Tests.Cache.PublishedCache
_xml.LoadXml(GetXml());
var xmlStore = new XmlStore(() => _xml, null, null, null, HostingEnvironment);
var appCache = new DictionaryAppCache();
var domainCache = new DomainCache(ServiceContext.DomainService, DefaultCultureAccessor);
var domainCache = new DomainCache(Mock.Of<IDomainService>(), DefaultCultureAccessor);
var publishedShapshot = new PublishedSnapshot(
new PublishedContentCache(xmlStore, domainCache, appCache, globalSettings, ContentTypesCache, null, VariationContextAccessor, null),
new PublishedMediaCache(xmlStore, ServiceContext.MediaService, ServiceContext.UserService, appCache, ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), umbracoContextAccessor, VariationContextAccessor),
new PublishedMemberCache(null, appCache, Current.Services.MemberService, ContentTypesCache, Current.Services.UserService, VariationContextAccessor),
new PublishedMediaCache(xmlStore, Mock.Of<IMediaService>(), Mock.Of<IUserService>(), appCache, ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), umbracoContextAccessor, VariationContextAccessor),
new PublishedMemberCache(null, appCache, Mock.Of<IMemberService>(), ContentTypesCache, Mock.Of<IUserService>(), VariationContextAccessor),
domainCache);
var publishedSnapshotService = new Mock<IPublishedSnapshotService>();
publishedSnapshotService.Setup(x => x.CreatePublishedSnapshot(It.IsAny<string>())).Returns(publishedShapshot);
@@ -78,7 +77,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
_umbracoContext = new UmbracoContext(
_httpContextFactory.HttpContext,
publishedSnapshotService.Object,
new WebSecurity(_httpContextFactory.HttpContext, Current.Services.UserService, globalSettings),
new WebSecurity(_httpContextFactory.HttpContext, Mock.Of<IUserService>(), globalSettings),
umbracoSettings,
Enumerable.Empty<IUrlProvider>(),
Enumerable.Empty<IMediaUrlProvider>(),