Correcting issues after running unit tests

This commit is contained in:
Morten Christensen
2012-11-14 13:27:34 -01:00
parent 9cb12fa3c0
commit 52d65106f5
3 changed files with 12 additions and 7 deletions

View File

@@ -751,7 +751,8 @@ namespace Umbraco.Core.Services
Save(content, userId);
}
Moved(content, e);
if(Moved != null)
Moved(content, e);
}
}
@@ -802,7 +803,8 @@ namespace Umbraco.Core.Services
_unitOfWork.Commit();
}
Copied(copy, e);
if(Copied != null)
Copied(copy, e);
return copy;
}

View File

@@ -117,7 +117,9 @@ namespace Umbraco.Tests.Services
});
// Act
var content = ServiceContext.ContentService.CreateContent(-1, "umbTextpage");
var contentService = ServiceContext.ContentService as ContentService;
contentService.SetHttpContext(null);
var content = contentService.CreateContent(-1, "umbTextpage");
// Assert
Assert.That(content, Is.Not.Null);
@@ -687,6 +689,8 @@ namespace Umbraco.Tests.Services
public override void TearDown()
{
base.TearDown();
ServiceContext = null;
}
public void CreateTestData()

View File

@@ -59,6 +59,7 @@ namespace Umbraco.Tests.TestHelpers
Resolution.Freeze();
ApplicationContext = new ApplicationContext() { IsReady = true };
DatabaseContext = DatabaseContext.Current;
ServiceContext = ServiceContext.Current;
//Configure the Database and Sql Syntax based on connection string set in config
DatabaseContext.Initialize();
@@ -72,6 +73,7 @@ namespace Umbraco.Tests.TestHelpers
//reset the app context
DatabaseContext = null;
ApplicationContext.Current = null;
ServiceContext = null;
Resolution.IsFrozen = false;
string path = TestHelper.CurrentAssemblyDirectory;
@@ -86,10 +88,7 @@ namespace Umbraco.Tests.TestHelpers
protected ApplicationContext ApplicationContext { get; set; }
protected ServiceContext ServiceContext
{
get { return ServiceContext.Current; }
}
protected ServiceContext ServiceContext { get; set; }
protected DatabaseContext DatabaseContext { get; set; }