diff --git a/src/Umbraco.Core/ApplicationContext.cs b/src/Umbraco.Core/ApplicationContext.cs index 3ac680d4ab..e96c45cd17 100644 --- a/src/Umbraco.Core/ApplicationContext.cs +++ b/src/Umbraco.Core/ApplicationContext.cs @@ -72,7 +72,7 @@ namespace Umbraco.Core /// /// A method used to create and ensure that a global ApplicationContext singleton is created. /// - /// + /// /// /// If set to true will replace the current singleton instance - This should only be used for unit tests or on app /// startup if for some reason the boot manager is not the umbraco boot manager. @@ -83,14 +83,14 @@ namespace Umbraco.Core /// /// This is NOT thread safe /// - public static ApplicationContext EnsureContext(DatabaseContext dbContext, ServiceContext serviceContext, bool enableCache, bool replaceContext) + public static ApplicationContext EnsureContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache, bool replaceContext) { if (ApplicationContext.Current != null) { if (!replaceContext) return ApplicationContext.Current; } - var ctx = new ApplicationContext(dbContext, serviceContext, enableCache); + var ctx = new ApplicationContext(dbContext, serviceContext, cache); ApplicationContext.Current = ctx; return ApplicationContext.Current; } diff --git a/src/Umbraco.Core/CacheHelper.cs b/src/Umbraco.Core/CacheHelper.cs index 0de92e1259..0eab57c9d5 100644 --- a/src/Umbraco.Core/CacheHelper.cs +++ b/src/Umbraco.Core/CacheHelper.cs @@ -32,7 +32,7 @@ namespace Umbraco.Core /// /// Good for unit testing /// - internal static CacheHelper CreateDisabledCacheHelper() + public static CacheHelper CreateDisabledCacheHelper() { return new CacheHelper(null, null, null, false); } diff --git a/src/Umbraco.Core/Services/ServiceContext.cs b/src/Umbraco.Core/Services/ServiceContext.cs index 00f5e5d6c5..cb14d42bf5 100644 --- a/src/Umbraco.Core/Services/ServiceContext.cs +++ b/src/Umbraco.Core/Services/ServiceContext.cs @@ -124,10 +124,10 @@ namespace Umbraco.Core.Services _sectionService = new Lazy(() => new SectionService(_userService.Value, _treeService.Value, cache)); if (_macroService == null) - _macroService = new Lazy(() => new MacroService(provider, repositoryFactory.Value)); + _macroService = new Lazy(() => new MacroService(provider, repositoryFactory.Value)); if (_memberTypeService == null) - _memberTypeService = new Lazy(() => new MemberTypeService(provider, repositoryFactory.Value)); + _memberTypeService = new Lazy(() => new MemberTypeService(provider, repositoryFactory.Value)); } /// @@ -250,14 +250,6 @@ namespace Umbraco.Core.Services get { return _treeService.Value; } } - /// - /// Gets the MemberTypeService - /// - internal MemberTypeService MemberTypeService - { - get { return _memberTypeService.Value; } - } - /// /// Gets the MemberTypeService /// @@ -265,6 +257,6 @@ namespace Umbraco.Core.Services { get { return _memberTypeService.Value; } } - + } } \ No newline at end of file diff --git a/src/Umbraco.Tests/MockTests.cs b/src/Umbraco.Tests/MockTests.cs index be31d2dbf4..58612bc7b4 100644 --- a/src/Umbraco.Tests/MockTests.cs +++ b/src/Umbraco.Tests/MockTests.cs @@ -20,7 +20,7 @@ namespace Umbraco.Tests [Test] public void Can_Create_Empty_App_Context() { - var appCtx = new ApplicationContext(false); + var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper()); Assert.Pass(); } @@ -84,14 +84,14 @@ namespace Umbraco.Tests new Mock().Object, new RepositoryFactory(true), new Mock().Object)), - false); + CacheHelper.CreateDisabledCacheHelper()); Assert.Pass(); } [Test] public void Can_Assign_App_Context_Singleton() { - var appCtx = new ApplicationContext(false); + var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper()); var result = ApplicationContext.EnsureContext(appCtx, true); Assert.AreEqual(appCtx, result); } @@ -99,8 +99,8 @@ namespace Umbraco.Tests [Test] public void Does_Not_Overwrite_App_Context_Singleton() { - ApplicationContext.EnsureContext(new ApplicationContext(false), true); - var appCtx = new ApplicationContext(false); + ApplicationContext.EnsureContext(new ApplicationContext(CacheHelper.CreateDisabledCacheHelper()), true); + var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper()); var result = ApplicationContext.EnsureContext(appCtx, false); Assert.AreNotEqual(appCtx, result); } @@ -109,7 +109,7 @@ namespace Umbraco.Tests [Test] public void Can_Get_Umbraco_Context() { - var appCtx = new ApplicationContext(false); + var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper()); ApplicationContext.EnsureContext(appCtx, true); var umbCtx = UmbracoContext.EnsureContext(