Fix unit test memory leak

Shutdown ASP.NET AppDomains after running each SpecFlow scenario.

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-05-22 17:50:18 -07:00
parent ef34e58ed5
commit 01c7e29db2
8 changed files with 57 additions and 12 deletions

View File

@@ -14,10 +14,10 @@ using HtmlAgilityPack;
using log4net.Appender;
using log4net.Core;
using log4net.Repository;
using NUnit.Framework;
using Orchard.Specs.Hosting;
using Orchard.Specs.Util;
using TechTalk.SpecFlow;
using NUnit.Framework;
namespace Orchard.Specs.Bindings {
[Binding]
@@ -27,6 +27,9 @@ namespace Orchard.Specs.Bindings {
private HtmlDocument _doc;
private MessageSink _messages;
public WebAppHosting() {
}
public WebHost Host {
get { return _webHost; }
}
@@ -36,6 +39,14 @@ namespace Orchard.Specs.Bindings {
set { _details = value; }
}
[AfterScenario]
public void AfterScenario() {
if (_webHost != null) {
_webHost.Dispose();
_webHost = null;
}
}
[Given(@"I have a clean site")]
public void GivenIHaveACleanSite() {
GivenIHaveACleanSiteBasedOn("Orchard.Web");