Updated SettingsForTest to return mockable umbraco settings so we can set whatever we want. Fixing up unit tests. Removes calls to CleanUmbracoSettingsConfig and EnsureUmbracoSettingsConfig since we should be dealing with the mockable settings.

This commit is contained in:
Shannon
2013-09-16 19:33:21 +10:00
parent b043ee577f
commit 48db556d1b
17 changed files with 183 additions and 166 deletions

View File

@@ -13,10 +13,15 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
return new OptionalCommaDelimitedConfigurationElement(
(CommaDelimitedConfigurationElement)this["imageFileTypes"],
//set the default
new[] { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" });
GetDefaultImageFileTypes());
}
}
internal static string[] GetDefaultImageFileTypes()
{
return new[] {"jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif"};
}
[ConfigurationProperty("allowedAttributes")]
internal CommaDelimitedConfigurationElement ImageTagAllowedAttributes
{
@@ -61,5 +66,16 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
internal static ImagingAutoFillPropertiesCollection GetDefaultImageAutoFillProperties()
{
return new ImagingAutoFillPropertiesCollection
{
new ImagingAutoFillUploadFieldElement
{
Alias = "umbracoFile"
}
};
}
}
}

View File

@@ -47,7 +47,21 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
var urls = this[prop] as ConfigurationElement;
if (urls != null && urls.ElementInformation.IsPresent == false)
{
var dictionary = new Dictionary<char, string>()
_defaultUrlReplacing = new UrlReplacingElement()
{
CharCollection = GetDefaultCharReplacements()
};
return _defaultUrlReplacing;
}
return (UrlReplacingElement)this["urlReplacing"];
}
}
internal static CharCollection GetDefaultCharReplacements()
{
var dictionary = new Dictionary<char, string>()
{
{' ',"-"},
{'\"',""},
@@ -77,28 +91,19 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{'>',""}
};
//const string chars = @" ,"",',%,.,;,/,\,:,#,+,*,&,?,æ,ø,å,ä,ö,ü,ß,Ä,Ö,|,<,>";
//const string chars = @" ,"",',%,.,;,/,\,:,#,+,*,&,?,æ,ø,å,ä,ö,ü,ß,Ä,Ö,|,<,>";
var collection = new CharCollection();
foreach (var c in dictionary)
{
collection.Add(new CharElement
{
Char = c.Key.ToString(CultureInfo.InvariantCulture),
Replacement = c.Value.ToString(CultureInfo.InvariantCulture)
});
}
_defaultUrlReplacing = new UrlReplacingElement()
{
CharCollection = collection
};
return _defaultUrlReplacing;
}
return (UrlReplacingElement)this["urlReplacing"];
var collection = new CharCollection();
foreach (var c in dictionary)
{
collection.Add(new CharElement
{
Char = c.Key.ToString(CultureInfo.InvariantCulture),
Replacement = c.Value.ToString(CultureInfo.InvariantCulture)
});
}
return collection;
}
bool IRequestHandlerSection.UseDomainPrefixes