diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 10446c7f5c..dc00fc41f0 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -42,15 +42,24 @@ namespace Umbraco.Core.Configuration #endregion /// - /// used for unit tests + /// Used in unit testing to reset all config items that were set with property setters (i.e. did not come from config) /// - internal static void ResetCache() + private static void ResetInternal() { _reservedUrlsCache = null; _reservedPaths = null; _reservedUrls = null; } + /// + /// Resets settings that were set programmatically, to their initial values. + /// + /// To be used in unit tests. + internal static void Reset() + { + ResetInternal(); + } + /// /// Gets the reserved urls from web.config. /// diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings.cs b/src/Umbraco.Core/Configuration/UmbracoSettings.cs index c010e24347..4e4b0b5801 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings.cs @@ -54,7 +54,7 @@ namespace Umbraco.Core.Configuration /// /// Used in unit testing to reset all config items that were set with property setters (i.e. did not come from config) /// - private static void ResetSetters() + private static void ResetInternal() { _addTrailingSlash = null; _forceSafeAliases = null; @@ -1452,7 +1452,7 @@ namespace Umbraco.Core.Configuration /// To be used in unit tests. internal static void Reset() { - ResetSetters(); + ResetInternal(); using (new WriteLock(SectionsLock)) { diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index 5040927000..7dd9e64e52 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -100,7 +100,8 @@ namespace Umbraco.Tests.TestHelpers public static void Reset() { UmbracoSettings.Reset(); - GlobalSettings.ResetCache(); + GlobalSettings.Reset(); + foreach (var kvp in SavedAppSettings) ConfigurationManager.AppSettings.Set(kvp.Key, kvp.Value);