Fixes unit tests which require the ApplicationContext.Current singleton to be setup

This commit is contained in:
Shannon Deminick
2013-04-01 23:30:19 +06:00
parent a2a539f7db
commit a638488eb7
3 changed files with 4 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ namespace Umbraco.Tests.PublishedContent
public override void Initialize()
{
base.Initialize();
UmbracoSettings.SettingsFilePath = Core.IO.IOHelper.MapPath(Core.IO.SystemDirectories.Config + Path.DirectorySeparatorChar, false);
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
@@ -47,7 +47,7 @@ namespace Umbraco.Tests.PublishedContent
public override void TearDown()
{
base.TearDown();
PropertyEditorValueConvertersResolver.Reset();
PublishedContentStoreResolver.Reset();
PublishedMediaStoreResolver.Reset();

View File

@@ -51,9 +51,6 @@ namespace Umbraco.Tests.Routing
{
base.Initialize();
//the module requires that the singleton is setup
ApplicationContext.Current = ApplicationContext;
//create the module
_module = new UmbracoModule();

View File

@@ -33,6 +33,8 @@ namespace Umbraco.Tests.TestHelpers
TestHelper.InitializeDatabase();
Resolution.Freeze();
ApplicationContext = new ApplicationContext() { IsReady = true };
//init the singleton too!
ApplicationContext.Current = ApplicationContext;
//we need to clear out all currently created template files
var masterPages = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Masterpages));
masterPages.GetFiles().ForEach(x => x.Delete());