diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs index 0dbaae019a..58a544e073 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs @@ -5,6 +5,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { internal class CharCollection : ConfigurationElementCollection, IEnumerable { + internal void Add(CharElement c) + { + BaseAdd(c); + } + protected override ConfigurationElement CreateNewElement() { return new CharElement(); diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs index d6ec9fe890..7e98b8e266 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs @@ -2,9 +2,19 @@ { internal class CharElement : InnerTextConfigurationElement { - internal string Char + private string _char; + private string _replacement; + + public string Char { - get { return RawXml.Attribute("org").Value; } + get { return _char ?? (_char = (string)RawXml.Attribute("org")); } + set { _char = value; } + } + + public string Replacement + { + get { return _replacement ?? (_replacement = Value); } + set { _replacement = value; } } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs index 3f39c8af05..1eaf11e58a 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs @@ -28,23 +28,32 @@ namespace Umbraco.Core.Configuration.UmbracoSettings } } + private ContentImagingAutoFillPropertiesCollection _defaultImageAutoFill; + [ConfigurationCollection(typeof(ContentImagingAutoFillPropertiesCollection), AddItemName = "uploadField")] [ConfigurationProperty("autoFillImageProperties", IsDefaultCollection = true)] public ContentImagingAutoFillPropertiesCollection ImageAutoFillProperties { get { + if (_defaultImageAutoFill != null) + { + return _defaultImageAutoFill; + } + //here we need to check if this element is defined, if it is not then we'll setup the defaults var prop = Properties["autoFillImageProperties"]; var autoFill = this[prop] as ConfigurationElement; if (autoFill != null && autoFill.ElementInformation.IsPresent == false) { - var collection = new ContentImagingAutoFillPropertiesCollection(); - collection.Add(new ContentImagingAutoFillUploadFieldElement + _defaultImageAutoFill = new ContentImagingAutoFillPropertiesCollection { - Alias = "umbracoFile" - }); - base["autoFillImageProperties"] = collection; + new ContentImagingAutoFillUploadFieldElement + { + Alias = "umbracoFile" + } + }; + return _defaultImageAutoFill; } return (ContentImagingAutoFillPropertiesCollection) base["autoFillImageProperties"]; diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs index ca16460cc4..e88e94f754 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs @@ -4,11 +4,18 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { internal class DeveloperElement : ConfigurationElement { + private AppCodeFileExtensionsElement _default; + [ConfigurationProperty("appCodeFileExtensions")] internal AppCodeFileExtensionsElement AppCodeFileExtensions { get { + if (_default != null) + { + return _default; + } + //here we need to check if this element is defined, if it is not then we'll setup the defaults var prop = Properties["appCodeFileExtensions"]; var autoFill = this[prop] as ConfigurationElement; @@ -19,12 +26,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings new FileExtensionElement {RawValue = "cs"}, new FileExtensionElement {RawValue = "vb"} }; - var element = new AppCodeFileExtensionsElement + _default = new AppCodeFileExtensionsElement { AppCodeFileExtensionsCollection = collection }; - return element; + return _default; } return (AppCodeFileExtensionsElement)base["appCodeFileExtensions"]; diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs index 8889736b9b..e7764cc369 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs @@ -4,7 +4,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { internal class DistributedCallElement : ConfigurationElement { - [ConfigurationProperty("enable")] + [ConfigurationProperty("enable", DefaultValue = false)] public bool Enabled { get { return (bool)base["enable"]; } @@ -13,7 +13,13 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("user")] internal InnerTextConfigurationElement UserId { - get { return (InnerTextConfigurationElement)this["user"]; } + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["user"], + //set the default + 0); + } } [ConfigurationCollection(typeof(ServerCollection), AddItemName = "server")] diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/HelpElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/HelpElement.cs index 0a4e1b2108..fd63f6bb06 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/HelpElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/HelpElement.cs @@ -4,7 +4,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { internal class HelpElement : ConfigurationElement { - [ConfigurationProperty("defaultUrl")] + [ConfigurationProperty("defaultUrl", DefaultValue = "http://our.umbraco.org/wiki/umbraco-help/{0}/{1}")] public string DefaultUrl { get { return (string) base["defaultUrl"]; } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs index e6f16fa2de..55dfcb39d3 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs @@ -4,18 +4,25 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { internal class RazorElement : ConfigurationElement { + private NotDynamicXmlDocumentElementCollection _defaultCollection; + [ConfigurationCollection(typeof (NotDynamicXmlDocumentElementCollection), AddItemName = "element")] [ConfigurationProperty("notDynamicXmlDocumentElements", IsDefaultCollection = true)] public NotDynamicXmlDocumentElementCollection NotDynamicXmlDocumentElements { get { + if (_defaultCollection != null) + { + return _defaultCollection; + } + //here we need to check if this element is defined, if it is not then we'll setup the defaults var prop = Properties["notDynamicXmlDocumentElements"]; - var autoFill = this[prop] as ConfigurationElement; + var autoFill = this[prop] as ConfigurationElementCollection; if (autoFill != null && autoFill.ElementInformation.IsPresent == false) { - var collection = new NotDynamicXmlDocumentElementCollection + _defaultCollection = new NotDynamicXmlDocumentElementCollection { new NotDynamicXmlDocumentElement {RawValue = "p"}, new NotDynamicXmlDocumentElement {RawValue = "div"}, @@ -23,7 +30,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings new NotDynamicXmlDocumentElement {RawValue = "span"} }; - return collection; + //must return the collection directly + return _defaultCollection; } return (NotDynamicXmlDocumentElementCollection)base["notDynamicXmlDocumentElements"]; diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs index f129af69a4..de05be32d1 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs @@ -5,6 +5,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { internal class RepositoriesCollection : ConfigurationElementCollection, IEnumerable { + internal void Add(RepositoryElement item) + { + BaseAdd(item); + } + protected override ConfigurationElement CreateNewElement() { return new RepositoryElement(); diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs index d217c96154..3144724cbf 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs @@ -1,14 +1,17 @@ -using System.Configuration; +using System; +using System.Configuration; namespace Umbraco.Core.Configuration.UmbracoSettings { internal class RepositoriesElement : ConfigurationElement { + [ConfigurationCollection(typeof(RepositoriesCollection), AddItemName = "repository")] [ConfigurationProperty("", IsDefaultCollection = true)] public RepositoriesCollection Repositories { - get { return (RepositoriesCollection)base[""]; } + get { return (RepositoriesCollection) base[""]; } + set { base[""] = value; } } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs index 39b0c41afa..deb8bc3ee8 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs @@ -9,12 +9,14 @@ namespace Umbraco.Core.Configuration.UmbracoSettings internal string Name { get { return (string)base["name"]; } + set { base["name"] = value; } } [ConfigurationProperty("guid")] internal Guid Id { get { return (Guid)base["guid"]; } + set { base["guid"] = value; } } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs index dc132b09fc..b2430079f7 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs @@ -1,4 +1,7 @@ -using System.Configuration; +using System; +using System.Configuration; +using System.Globalization; +using System.Collections.Generic; namespace Umbraco.Core.Configuration.UmbracoSettings { @@ -28,10 +31,74 @@ namespace Umbraco.Core.Configuration.UmbracoSettings } } + private UrlReplacingElement _defaultUrlReplacing; [ConfigurationProperty("urlReplacing")] internal UrlReplacingElement UrlReplacing { - get { return (UrlReplacingElement)this["urlReplacing"]; } + get + { + if (_defaultUrlReplacing != null) + { + return _defaultUrlReplacing; + } + + //here we need to check if this element is defined, if it is not then we'll setup the defaults + var prop = Properties["urlReplacing"]; + var urls = this[prop] as ConfigurationElement; + if (urls != null && urls.ElementInformation.IsPresent == false) + { + var dictionary = new Dictionary() + { + {' ',"-"}, + {'\"',""}, + {'\'',""}, + {'%',""}, + {'.',""}, + {';',""}, + {'/',""}, + {'\\',""}, + {':',""}, + {'#',""}, + {'+',"plus"}, + {'*',"star"}, + {'&',""}, + {'?',""}, + {'æ',"ae"}, + {'ø',"oe"}, + {'å',"aa"}, + {'ä',"ae"}, + {'ö',"oe"}, + {'ü',"ue"}, + {'ß',"ss"}, + {'Ä',"ae"}, + {'Ö',"oe"}, + {'|',"-"}, + {'<',""}, + {'>',""} + }; + + //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"]; + } } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs index e9e743c92b..ff526c51d6 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs @@ -31,7 +31,13 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("defaultRenderingEngine", IsRequired = true)] internal InnerTextConfigurationElement DefaultRenderingEngine { - get { return (InnerTextConfigurationElement)this["defaultRenderingEngine"]; } + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["defaultRenderingEngine"], + //set the default + RenderingEngine.Mvc); + } } [ConfigurationProperty("enableTemplateFolders")] diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs index 1df2c0ae1f..a8852b267e 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs @@ -1,4 +1,5 @@ -using System.Configuration; +using System; +using System.Configuration; namespace Umbraco.Core.Configuration.UmbracoSettings { @@ -67,11 +68,41 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { get { return (DistributedCallElement)this["distributedCall"]; } } - + + private RepositoriesElement _defaultRepositories; + [ConfigurationProperty("repositories")] internal RepositoriesElement PackageRepositories { - get { return (RepositoriesElement)this["repositories"]; } + get + { + + if (_defaultRepositories != null) + { + return _defaultRepositories; + } + + //here we need to check if this element is defined, if it is not then we'll setup the defaults + var prop = Properties["repositories"]; + var repos = this[prop] as ConfigurationElement; + if (repos != null && repos.ElementInformation.IsPresent == false) + { + var collection = new RepositoriesCollection + { + new RepositoryElement() {Name = "Umbraco package Repository", Id = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66")} + }; + + + _defaultRepositories = new RepositoriesElement() + { + Repositories = collection + }; + + return _defaultRepositories; + } + + return (RepositoriesElement)base["repositories"]; + } } [ConfigurationProperty("providers")] diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs index f69569ce99..c780f6f082 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs @@ -15,6 +15,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings public CharCollection CharCollection { get { return (CharCollection)base[""]; } + set { base[""] = value; } } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UserProviderElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UserProviderElement.cs index 87c04229d5..ce830fba4a 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/UserProviderElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UserProviderElement.cs @@ -7,7 +7,13 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("DefaultBackofficeProvider")] internal InnerTextConfigurationElement DefaultBackOfficeProvider { - get { return (InnerTextConfigurationElement)this["DefaultBackofficeProvider"]; } + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["DefaultBackofficeProvider"], + //set the default + "UsersMembershipProvider"); + } } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/WebRoutingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/WebRoutingElement.cs index 51b6e21566..193b70d099 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/WebRoutingElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/WebRoutingElement.cs @@ -4,13 +4,13 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { internal class WebRoutingElement : ConfigurationElement { - [ConfigurationProperty("trySkipIisCustomErrors")] + [ConfigurationProperty("trySkipIisCustomErrors", DefaultValue = "false")] public bool TrySkipIisCustomErrors { get { return (bool) base["trySkipIisCustomErrors"]; } } - [ConfigurationProperty("internalRedirectPreservesTemplate")] + [ConfigurationProperty("internalRedirectPreservesTemplate", DefaultValue = "false")] public bool InternalRedirectPreservesTemplate { get { return (bool) base["internalRedirectPreservesTemplate"]; } diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementDefaultTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementDefaultTests.cs new file mode 100644 index 0000000000..adc0426062 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementDefaultTests.cs @@ -0,0 +1,26 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class DistributedCallElementDefaultTests : DistributedCallElementTests + { + protected override bool TestingDefaults + { + get { return true; } + } + + [Test] + public override void Enabled() + { + Assert.IsTrue(Section.DistributedCall.Enabled == false); + + } + + [Test] + public override void Servers() + { + Assert.IsTrue(Section.DistributedCall.Servers.Count == 0); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs index 8cd93a7504..3a0291a24d 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs @@ -7,7 +7,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings public class DistributedCallElementTests : UmbracoSettingsTests { [Test] - public void Enabled() + public virtual void Enabled() { Assert.IsTrue(Section.DistributedCall.Enabled == true); @@ -19,7 +19,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings } [Test] - public void Servers() + public virtual void Servers() { Assert.IsTrue(Section.DistributedCall.Servers.Count == 2); Assert.IsTrue(Section.DistributedCall.Servers.ElementAt(0).Value == "127.0.0.1"); @@ -27,5 +27,6 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings Assert.IsTrue(Section.DistributedCall.Servers.ElementAt(1).ForceProtocol == "https"); Assert.IsTrue(Section.DistributedCall.Servers.ElementAt(1).ForcePortnumber == "443"); } + } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementDefaultTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementDefaultTests.cs new file mode 100644 index 0000000000..9c58b2d204 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementDefaultTests.cs @@ -0,0 +1,19 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class HelpElementDefaultTests : HelpElementTests + { + protected override bool TestingDefaults + { + get { return true; } + } + + [Test] + public override void Links() + { + Assert.IsTrue(Section.Help.Links.Count == 0); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementTests.cs index f34dad5098..db17d76cdc 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementTests.cs @@ -13,7 +13,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings } [Test] - public void Links() + public virtual void Links() { Assert.IsTrue(Section.Help.Links.Count == 2); Assert.IsTrue(Section.Help.Links.ElementAt(0).Application == "content"); diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs index 396e765a87..cc9df2f16e 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs @@ -8,7 +8,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings public class PackageRepositoriesElementTests : UmbracoSettingsTests { [Test] - public void Repositories() + public virtual void Repositories() { Assert.IsTrue(Section.PackageRepositories.Repositories.Count == 2); Assert.IsTrue(Section.PackageRepositories.Repositories.ElementAt(0).Id == Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66")); @@ -17,4 +17,21 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings Assert.IsTrue(Section.PackageRepositories.Repositories.ElementAt(1).Name == "Test Repo"); } } + + [TestFixture] + public class PackageRepositoriesElementDefaultTests : PackageRepositoriesElementTests + { + protected override bool TestingDefaults + { + get { return true; } + } + + [Test] + public override void Repositories() + { + Assert.IsTrue(Section.PackageRepositories.Repositories.Count == 1); + Assert.IsTrue(Section.PackageRepositories.Repositories.ElementAt(0).Id == Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66")); + Assert.IsTrue(Section.PackageRepositories.Repositories.ElementAt(0).Name == "Umbraco package Repository"); + } + } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ProvidersElementDefaultTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ProvidersElementDefaultTests.cs new file mode 100644 index 0000000000..c2f6dd4a9c --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ProvidersElementDefaultTests.cs @@ -0,0 +1,14 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ProvidersElementDefaultTests : ProvidersElementTests + { + protected override bool TestingDefaults + { + get { return true; } + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs index cf13149944..8ccb893e38 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs @@ -1,5 +1,6 @@ using System.Linq; using NUnit.Framework; +using Umbraco.Core; namespace Umbraco.Tests.Configurations.UmbracoSettings { @@ -25,15 +26,28 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings } [Test] public void CharCollection() - { - Assert.IsTrue(Section.RequestHandler.UrlReplacing.CharCollection.Count == 26); + { var chars = @" ,"",',%,.,;,/,\,:,#,+,*,&,?,æ,ø,å,ä,ö,ü,ß,Ä,Ö,|,<,>"; + var items = chars.Split(','); + Assert.AreEqual(items.Length, Section.RequestHandler.UrlReplacing.CharCollection.Count); Assert.IsTrue(Section.RequestHandler.UrlReplacing.CharCollection - .All(x => chars.Split(',').Contains(x.Char))); - var vals = @"-,plus,star,ae,oe,aa,ae,oe,ue,ss,ae,oe"; + .All(x => items.Contains(x.Char))); + + var vals = @"-,plus,star,ae,oe,aa,ae,oe,ue,ss,ae,oe,-"; + var splitVals = vals.Split(','); + Assert.AreEqual(splitVals.Length, Section.RequestHandler.UrlReplacing.CharCollection.Count(x => x.Replacement.IsNullOrWhiteSpace() == false)); Assert.IsTrue(Section.RequestHandler.UrlReplacing.CharCollection - .All(x => string.IsNullOrEmpty(x.Value) || vals.Split(',').Contains(x.Value))); + .All(x => string.IsNullOrEmpty(x.Replacement) || vals.Split(',').Contains(x.Replacement))); } } + + [TestFixture] + public class RequestHandlerElementDefaultTests : RequestHandlerElementTests + { + protected override bool TestingDefaults + { + get { return true; } + } + } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs index feb308ac31..ffb5a3bc09 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs @@ -17,4 +17,15 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings Assert.IsTrue(Section.WebRouting.TrySkipIisCustomErrors == false); } } + + [TestFixture] + public class WebRoutingElementDefaultTests : WebRoutingElementTests + { + + protected override bool TestingDefaults + { + get { return true; } + } + + } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config index 7b3a90aa9b..c03c08b1a0 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config @@ -13,93 +13,4 @@ - - - - - - - - - - - - - - plus - star - - - ae - oe - aa - ae - oe - ue - ss - ae - oe - - - - - - - - - Mvc - - - - - - - 0 - - - - 127.0.0.1 - 127.0.0.2 - - - - - - - - - - - - - - - UsersMembershipProvider - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 1abba9a1ba..fed2d5c172 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -215,11 +215,14 @@ + + +