diff --git a/src/Umbraco.Core/ApplicationContext.cs b/src/Umbraco.Core/ApplicationContext.cs
index 84cbb70448..61aa7029d6 100644
--- a/src/Umbraco.Core/ApplicationContext.cs
+++ b/src/Umbraco.Core/ApplicationContext.cs
@@ -38,6 +38,15 @@ namespace Umbraco.Core
ApplicationCache = cache;
}
+ ///
+ /// Creates a basic app context
+ ///
+ ///
+ internal ApplicationContext(CacheHelper cache)
+ {
+ ApplicationCache = cache;
+ }
+
///
/// Singleton accessor
///
diff --git a/src/Umbraco.Tests/Macros/MacroTests.cs b/src/Umbraco.Tests/Macros/MacroTests.cs
index 76da493251..98356919e6 100644
--- a/src/Umbraco.Tests/Macros/MacroTests.cs
+++ b/src/Umbraco.Tests/Macros/MacroTests.cs
@@ -3,6 +3,7 @@ using System.IO;
using System.Web.Caching;
using NUnit.Framework;
using Umbraco.Core;
+using Umbraco.Core.Cache;
using Umbraco.Core.Profiling;
using umbraco;
using umbraco.cms.businesslogic.macro;
@@ -17,7 +18,11 @@ namespace Umbraco.Tests.Macros
public void Setup()
{
//we DO want cache enabled for these tests
- ApplicationContext.Current = new ApplicationContext(true);
+ var cacheHelper = new CacheHelper(
+ new ObjectCacheRuntimeCacheProvider(),
+ new StaticCacheProvider(),
+ new NullCacheProvider());
+ ApplicationContext.Current = new ApplicationContext(cacheHelper);
ProfilerResolver.Current = new ProfilerResolver(new LogProfiler())
{
CanResolveBeforeFrozen = true
diff --git a/src/Umbraco.Tests/Persistence/BaseTableByTableTest.cs b/src/Umbraco.Tests/Persistence/BaseTableByTableTest.cs
index d03ddc3142..b0b1d32460 100644
--- a/src/Umbraco.Tests/Persistence/BaseTableByTableTest.cs
+++ b/src/Umbraco.Tests/Persistence/BaseTableByTableTest.cs
@@ -30,7 +30,7 @@ namespace Umbraco.Tests.Persistence
new RepositoryFactory());
//disable cache
- var cacheHelper = new CacheHelper(new NullCacheProvider(), false);
+ var cacheHelper = CacheHelper.CreateDisabledCacheHelper();
ApplicationContext.Current = new ApplicationContext(
//assign the db context
diff --git a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs
index 420905536d..011f2826fa 100644
--- a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs
+++ b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs
@@ -21,7 +21,7 @@ namespace Umbraco.Tests.Persistence
_dbContext = new DatabaseContext(new DefaultDatabaseFactory());
//unfortunately we have to set this up because the PetaPocoExtensions require singleton access
- ApplicationContext.Current = new ApplicationContext(false)
+ ApplicationContext.Current = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper())
{
DatabaseContext = _dbContext,
IsReady = true
diff --git a/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs
index b0b03c5a78..41102d68c2 100644
--- a/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs
+++ b/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs
@@ -73,7 +73,7 @@ namespace Umbraco.Tests.PublishedCache
TestHelper.SetupLog4NetForTests();
//create the app context
- ApplicationContext.Current = new ApplicationContext(false);
+ ApplicationContext.Current = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper());
_httpContextFactory = new FakeHttpContextFactory("~/Home");
//ensure the StateHelper is using our custom context
diff --git a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs
index 7ba9ebc917..f7f043bd7a 100644
--- a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs
+++ b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs
@@ -39,7 +39,7 @@ namespace Umbraco.Tests.Services
ApplicationContext.DatabaseContext = new DatabaseContext(_dbFactory);
//disable cache
- var cacheHelper = new CacheHelper(new NullCacheProvider(), false);
+ var cacheHelper = CacheHelper.CreateDisabledCacheHelper();
//here we are going to override the ServiceContext because normally with our test cases we use a
//global Database object but this is NOT how it should work in the web world or in any multi threaded scenario.
diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
index 9e653d7d29..72021f4ed3 100644
--- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
+++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
@@ -59,7 +59,7 @@ namespace Umbraco.Tests.TestHelpers
AppDomain.CurrentDomain.SetData("DataDirectory", path);
//disable cache
- var cacheHelper = new CacheHelper(new NullCacheProvider(), false);
+ var cacheHelper = CacheHelper.CreateDisabledCacheHelper();
var dbFactory = new DefaultDatabaseFactory(
GetDbConnectionString(),
diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseTest.cs
index f521b78c1e..4c4aaa4619 100644
--- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseTest.cs
+++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseTest.cs
@@ -63,7 +63,7 @@ namespace Umbraco.Tests.TestHelpers
Resolution.Freeze();
//disable cache
- var cacheHelper = new CacheHelper(new NullCacheProvider(), false);
+ var cacheHelper = CacheHelper.CreateDisabledCacheHelper();
ApplicationContext.Current = new ApplicationContext(
//assign the db context
diff --git a/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs b/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs
index 76fc4917f6..c4b70d30db 100644
--- a/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs
+++ b/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs
@@ -89,7 +89,7 @@ namespace Umbraco.Tests.TestHelpers
protected virtual void SetupApplicationContext()
{
//disable cache
- var cacheHelper = new CacheHelper(new NullCacheProvider(), false);
+ var cacheHelper = CacheHelper.CreateDisabledCacheHelper();
ApplicationContext.Current = new ApplicationContext(
//assign the db context