Added moq (need to replace all rhino mock later) allowing us to nicely mock umbraco settings, fixing up more unit tests.

This commit is contained in:
Shannon
2013-09-17 00:14:15 +10:00
parent 48db556d1b
commit 86a5d16e25
38 changed files with 232 additions and 889 deletions

View File

@@ -23,13 +23,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
var autoFill = this[prop] as ConfigurationElementCollection;
if (autoFill != null && autoFill.ElementInformation.IsPresent == false)
{
_defaultCollection = new NotDynamicXmlDocumentElementCollection
{
new NotDynamicXmlDocumentElement {RawValue = "p"},
new NotDynamicXmlDocumentElement {RawValue = "div"},
new NotDynamicXmlDocumentElement {RawValue = "ul"},
new NotDynamicXmlDocumentElement {RawValue = "span"}
};
_defaultCollection = GetDefaultNotDynamicXmlDocuments();
//must return the collection directly
return _defaultCollection;
@@ -39,6 +33,17 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
internal static NotDynamicXmlDocumentElementCollection GetDefaultNotDynamicXmlDocuments()
{
return new NotDynamicXmlDocumentElementCollection
{
new NotDynamicXmlDocumentElement {RawValue = "p"},
new NotDynamicXmlDocumentElement {RawValue = "div"},
new NotDynamicXmlDocumentElement {RawValue = "ul"},
new NotDynamicXmlDocumentElement {RawValue = "span"}
};
}
[ConfigurationCollection(typeof (RazorStaticMappingCollection), AddItemName = "mapping")]
[ConfigurationProperty("dataTypeModelStaticMappings", IsDefaultCollection = true)]
internal RazorStaticMappingCollection DataTypeModelStaticMappings

View File

@@ -1,5 +1,6 @@
using System;
using System.Configuration;
using System.Linq;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
@@ -92,7 +93,14 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
return _defaultRepositories;
}
return (RepositoriesElement)base["repositories"];
//now we need to ensure there is *always* our umbraco repo! its hard coded in the codebase!
var reposElement = (RepositoriesElement)base["repositories"];
if (reposElement.Repositories.All(x => x.Id != new Guid("65194810-1f85-11dd-bd0b-0800200c9a66")))
{
reposElement.Repositories.Add(new RepositoryElement() { Name = "Umbraco package Repository", Id = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66") });
}
return reposElement;
}
}