From 8cb11de18c6f7c52544b103732c925808b46b56c Mon Sep 17 00:00:00 2001 From: Emma Garland Date: Fri, 31 Jan 2020 13:51:22 +0000 Subject: [PATCH 1/2] Replaced member service and user service with mocks --- .../Cache/PublishedCache/PublishedContentCacheTests.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs index 00fc5b09b8..0f9570ffd8 100644 --- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs +++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs @@ -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; @@ -70,7 +69,7 @@ namespace Umbraco.Tests.Cache.PublishedCache 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(), umbracoContextAccessor, VariationContextAccessor), - new PublishedMemberCache(null, appCache, Current.Services.MemberService, ContentTypesCache, Current.Services.UserService, VariationContextAccessor), + new PublishedMemberCache(null, appCache, Mock.Of(), ContentTypesCache, Mock.Of(), VariationContextAccessor), domainCache); var publishedSnapshotService = new Mock(); publishedSnapshotService.Setup(x => x.CreatePublishedSnapshot(It.IsAny())).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(), globalSettings), umbracoSettings, Enumerable.Empty(), Enumerable.Empty(), From e303d9e4f4e9ecaea011ccb7a081b198012a9625 Mon Sep 17 00:00:00 2001 From: Emma Garland Date: Fri, 31 Jan 2020 13:57:23 +0000 Subject: [PATCH 2/2] Mock IMediaService and IUserService --- .../Cache/PublishedCache/PublishedContentCacheTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs index 0f9570ffd8..7ef4495ad2 100644 --- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs +++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs @@ -65,10 +65,10 @@ 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(), 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(), umbracoContextAccessor, VariationContextAccessor), + new PublishedMediaCache(xmlStore, Mock.Of(), Mock.Of(), appCache, ContentTypesCache, Factory.GetInstance(), umbracoContextAccessor, VariationContextAccessor), new PublishedMemberCache(null, appCache, Mock.Of(), ContentTypesCache, Mock.Of(), VariationContextAccessor), domainCache); var publishedSnapshotService = new Mock();