Core.Configuration, Tests - refactor settings management

This commit is contained in:
Stephan
2013-03-12 12:02:04 -01:00
parent 2c6daa2918
commit 750370d148
3 changed files with 15 additions and 5 deletions

View File

@@ -42,15 +42,24 @@ namespace Umbraco.Core.Configuration
#endregion
/// <summary>
/// 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)
/// </summary>
internal static void ResetCache()
private static void ResetInternal()
{
_reservedUrlsCache = null;
_reservedPaths = null;
_reservedUrls = null;
}
/// <summary>
/// Resets settings that were set programmatically, to their initial values.
/// </summary>
/// <remarks>To be used in unit tests.</remarks>
internal static void Reset()
{
ResetInternal();
}
/// <summary>
/// Gets the reserved urls from web.config.
/// </summary>

View File

@@ -54,7 +54,7 @@ namespace Umbraco.Core.Configuration
/// <summary>
/// Used in unit testing to reset all config items that were set with property setters (i.e. did not come from config)
/// </summary>
private static void ResetSetters()
private static void ResetInternal()
{
_addTrailingSlash = null;
_forceSafeAliases = null;
@@ -1452,7 +1452,7 @@ namespace Umbraco.Core.Configuration
/// <remarks>To be used in unit tests.</remarks>
internal static void Reset()
{
ResetSetters();
ResetInternal();
using (new WriteLock(SectionsLock))
{

View File

@@ -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);