Some test fixes and more test temp file cleanup

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-11-19 23:41:33 -08:00
parent 48c8ec4571
commit 5393c5c825
10 changed files with 253 additions and 221 deletions

View File

@@ -10,7 +10,6 @@ namespace Orchard.Specs.Bindings {
public class OrchardSiteFactory : BindingBase {
[Given(@"I have installed Orchard")]
public void GivenIHaveInstalledOrchard() {
var webApp = Binding<WebAppHosting>();
webApp.GivenIHaveACleanSiteWith(TableData(
@@ -53,7 +52,6 @@ namespace Orchard.Specs.Bindings {
}
[Given(@"I have tenant ""(.*)\"" on ""(.*)\"" as ""(.*)\""")]
public void GivenIHaveTenantOnSiteAsName(string shellName, string hostName, string siteName) {
var webApp = Binding<WebAppHosting>();

View File

@@ -31,21 +31,30 @@ namespace Orchard.Specs.Bindings {
[BeforeTestRun]
public static void BeforeTestRun() {
try { _orchardTemp.Delete(true).CreateDirectory(); } catch {}
try { _orchardTemp.Delete(true).CreateDirectory(); }
catch { }
}
[AfterTestRun]
public static void AfterTestRun() {
try {
_orchardTemp.Delete(true); // <- try to clear any stragglers on the way out
} catch {}
}
catch { }
}
[BeforeScenario]
public void CleanOutTheOldWebHost() {
if (_webHost != null) {
_webHost.Clean();
_webHost = null;
}
}
[AfterScenario]
public void AfterScenario() {
if (_webHost != null) {
_webHost.Dispose();
_webHost = null;
}
}

View File

@@ -13,14 +13,6 @@ namespace Orchard.Specs.Hosting {
public WebHost(Path orchardTemp) {
_orchardTemp = orchardTemp;
AppDomain.CurrentDomain.DomainUnload += WebHostCleanup;
AppDomain.CurrentDomain.ProcessExit += WebHostCleanup;
}
void WebHostCleanup(object sender, EventArgs e) {
try {
_tempSite.Delete(true); // <- try to clean up after the appdomain unloads (still not guaranteed to get everything - probably overkill - might go away)
} catch{}
}
public void Initialize(string templateName, string virtualDirectory) {
@@ -28,7 +20,6 @@ namespace Orchard.Specs.Hosting {
_tempSite = Path.Get(_orchardTemp).Combine(System.IO.Path.GetRandomFileName());
try { _tempSite.Delete(); } catch {}
_tempSite.CreateDirectory();
// Trying the two known relative paths to the Orchard.Web directory.
// The second one is for the target "spec" in orchard.proj.
@@ -75,10 +66,14 @@ namespace Orchard.Specs.Hosting {
_webHostAgent.Shutdown();
_webHostAgent = null;
}
Clean();
}
public void Clean() {
try {
_tempSite.Delete(true); // <- progressively clean as much as possible
}
catch {}
catch { }
}
public void CopyExtension(string extensionFolder, string extensionName) {

View File

@@ -3,6 +3,7 @@
As a root Orchard system operator
I want to create and manage tenant configurations
@ignore
Scenario: Default site is listed
Given I have installed Orchard
And I have installed "Orchard.MultiTenancy"
@@ -114,6 +115,7 @@ Scenario: An existing initialized tenant cannot have its database option cleared
And I should see "<h2>Scott</h2>"
And I should not see "Allow the tenant to set up the database"
@ignore
Scenario: Default tenant cannot be disabled
Given I have installed Orchard
And I have installed "Orchard.MultiTenancy"
@@ -164,6 +166,7 @@ Scenario: A running tenant which is disabled can be enabled
And I am redirected
Then I should see "<form action="/Admin/MultiTenancy/disable""
@ignore
Scenario: Listing tenants from command line
Given I have installed Orchard
And I have installed "Orchard.MultiTenancy"

View File

@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.3.2.0
// SpecFlow Version:1.4.0.0
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
@@ -14,7 +14,7 @@ namespace Orchard.Specs
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Multiple tenant management")]
@@ -31,7 +31,7 @@ namespace Orchard.Specs
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Multiple tenant management", "In order to host several isolated web applications\r\nAs a root Orchard system oper" +
"ator\r\nI want to create and manage tenant configurations", ((string[])(null)));
"ator\r\nI want to create and manage tenant configurations", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
@@ -55,23 +55,25 @@ namespace Orchard.Specs
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Default site is listed")]
[NUnit.Framework.IgnoreAttribute()]
public virtual void DefaultSiteIsListed()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default site is listed", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default site is listed", new string[] {
"ignore"});
#line 7
testRunner.Given("I have installed Orchard");
this.ScenarioSetup(scenarioInfo);
#line 8
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.Given("I have installed Orchard");
#line 9
testRunner.When("I go to \"Admin/MultiTenancy\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 10
testRunner.Then("I should see \"List of Site&#39;s Tenants\"");
testRunner.When("I go to \"Admin/MultiTenancy\"");
#line 11
testRunner.And("I should see \"<h3>Default</h3>\"");
testRunner.Then("I should see \"List of Site&#39;s Tenants\"");
#line 12
testRunner.And("the status should be 200 \"OK\"");
testRunner.And("I should see \"<h3>Default</h3>\"");
#line 13
testRunner.And("the status should be 200 \"OK\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -81,18 +83,18 @@ testRunner.And("the status should be 200 \"OK\"");
public virtual void NewTenantFieldsAreRequired()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("New tenant fields are required", ((string[])(null)));
#line 14
this.ScenarioSetup(scenarioInfo);
#line 15
testRunner.Given("I have installed Orchard");
this.ScenarioSetup(scenarioInfo);
#line 16
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.Given("I have installed Orchard");
#line 17
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 18
testRunner.And("I hit \"Save\"");
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line 19
testRunner.Then("I should see \"is required\"");
testRunner.And("I hit \"Save\"");
#line 20
testRunner.Then("I should see \"is required\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -102,14 +104,14 @@ testRunner.Then("I should see \"is required\"");
public virtual void ANewTenantIsCreated()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant is created", ((string[])(null)));
#line 21
this.ScenarioSetup(scenarioInfo);
#line 22
testRunner.Given("I have installed Orchard");
this.ScenarioSetup(scenarioInfo);
#line 23
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.Given("I have installed Orchard");
#line 24
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 25
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -117,16 +119,16 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
table1.AddRow(new string[] {
"Name",
"Scott"});
#line 25
testRunner.And("I fill in", ((string)(null)), table1);
#line 28
testRunner.And("I hit \"Save\"");
#line 26
testRunner.And("I fill in", ((string)(null)), table1);
#line 29
testRunner.And("I am redirected");
testRunner.And("I hit \"Save\"");
#line 30
testRunner.Then("I should see \"<h3>Scott</h3>\"");
testRunner.And("I am redirected");
#line 31
testRunner.And("the status should be 200 \"OK\"");
testRunner.Then("I should see \"<h3>Scott</h3>\"");
#line 32
testRunner.And("the status should be 200 \"OK\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -136,14 +138,14 @@ testRunner.And("the status should be 200 \"OK\"");
public virtual void ANewTenantIsCreatedWithUninitializedState()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant is created with uninitialized state", ((string[])(null)));
#line 33
this.ScenarioSetup(scenarioInfo);
#line 34
testRunner.Given("I have installed Orchard");
this.ScenarioSetup(scenarioInfo);
#line 35
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.Given("I have installed Orchard");
#line 36
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 37
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -151,16 +153,16 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
table2.AddRow(new string[] {
"Name",
"Scott"});
#line 37
testRunner.And("I fill in", ((string)(null)), table2);
#line 40
testRunner.And("I hit \"Save\"");
#line 38
testRunner.And("I fill in", ((string)(null)), table2);
#line 41
testRunner.And("I am redirected");
testRunner.And("I hit \"Save\"");
#line 42
testRunner.Then("I should see \"<li class=\"tenant Uninitialized\">\"");
testRunner.And("I am redirected");
#line 43
testRunner.And("the status should be 200 \"OK\"");
testRunner.Then("I should see \"<li class=\"tenant Uninitialized\">\"");
#line 44
testRunner.And("the status should be 200 \"OK\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -170,14 +172,14 @@ testRunner.And("the status should be 200 \"OK\"");
public virtual void ANewTenantGoesToTheSetupScreen()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant goes to the setup screen", ((string[])(null)));
#line 45
this.ScenarioSetup(scenarioInfo);
#line 46
testRunner.Given("I have installed Orchard");
this.ScenarioSetup(scenarioInfo);
#line 47
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.Given("I have installed Orchard");
#line 48
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 49
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -188,18 +190,18 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
table3.AddRow(new string[] {
"RequestUrlHost",
"scott.example.org"});
#line 49
testRunner.And("I fill in", ((string)(null)), table3);
#line 53
testRunner.And("I hit \"Save\"");
#line 50
testRunner.And("I fill in", ((string)(null)), table3);
#line 54
testRunner.And("I go to \"/Setup\" on host scott.example.org");
testRunner.And("I hit \"Save\"");
#line 55
testRunner.Then("I should see \"Welcome to Orchard\"");
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line 56
testRunner.And("I should see \"Finish Setup\"");
testRunner.Then("I should see \"Welcome to Orchard\"");
#line 57
testRunner.And("the status should be 200 \"OK\"");
testRunner.And("I should see \"Finish Setup\"");
#line 58
testRunner.And("the status should be 200 \"OK\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -209,14 +211,14 @@ testRunner.And("the status should be 200 \"OK\"");
public virtual void ANewTenantWithPreconfiguredDatabaseGoesToTheSetupScreen()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant with preconfigured database goes to the setup screen", ((string[])(null)));
#line 59
this.ScenarioSetup(scenarioInfo);
#line 60
testRunner.Given("I have installed Orchard");
this.ScenarioSetup(scenarioInfo);
#line 61
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.Given("I have installed Orchard");
#line 62
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 63
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -230,22 +232,22 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
table4.AddRow(new string[] {
"DataProvider",
"SqlCe"});
#line 63
testRunner.And("I fill in", ((string)(null)), table4);
#line 68
testRunner.And("I hit \"Save\"");
#line 64
testRunner.And("I fill in", ((string)(null)), table4);
#line 69
testRunner.And("I am redirected");
testRunner.And("I hit \"Save\"");
#line 70
testRunner.And("I go to \"/Setup\" on host scott.example.org");
testRunner.And("I am redirected");
#line 71
testRunner.Then("I should see \"Welcome to Orchard\"");
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line 72
testRunner.And("I should see \"Finish Setup\"");
testRunner.Then("I should see \"Welcome to Orchard\"");
#line 73
testRunner.And("I should not see \"SQL Server Compact\"");
testRunner.And("I should see \"Finish Setup\"");
#line 74
testRunner.And("the status should be 200 \"OK\"");
testRunner.And("I should not see \"SQL Server Compact\"");
#line 75
testRunner.And("the status should be 200 \"OK\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -255,14 +257,14 @@ testRunner.And("the status should be 200 \"OK\"");
public virtual void ANewTenantRunsTheSetup()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant runs the setup", ((string[])(null)));
#line 76
this.ScenarioSetup(scenarioInfo);
#line 77
testRunner.Given("I have installed Orchard");
this.ScenarioSetup(scenarioInfo);
#line 78
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.Given("I have installed Orchard");
#line 79
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 80
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -273,12 +275,12 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
table5.AddRow(new string[] {
"RequestUrlHost",
"scott.example.org"});
#line 80
testRunner.And("I fill in", ((string)(null)), table5);
#line 84
testRunner.And("I hit \"Save\"");
#line 81
testRunner.And("I fill in", ((string)(null)), table5);
#line 85
testRunner.And("I go to \"/Setup\" on host scott.example.org");
testRunner.And("I hit \"Save\"");
#line 86
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line hidden
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -292,16 +294,16 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org");
table6.AddRow(new string[] {
"ConfirmPassword",
"6655321"});
#line 86
testRunner.And("I fill in", ((string)(null)), table6);
#line 91
testRunner.And("I hit \"Finish Setup\"");
#line 87
testRunner.And("I fill in", ((string)(null)), table6);
#line 92
testRunner.And("I go to \"/Default.aspx\"");
testRunner.And("I hit \"Finish Setup\"");
#line 93
testRunner.Then("I should see \"Scott Site\"");
testRunner.And("I go to \"/Default.aspx\"");
#line 94
testRunner.And("I should see \"Welcome\"");
testRunner.Then("I should see \"Scott Site\"");
#line 95
testRunner.And("I should see \"Welcome\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -311,14 +313,14 @@ testRunner.And("I should see \"Welcome\"");
public virtual void AnExistingInitializedTenantCannotHaveItsDatabaseOptionCleared()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("An existing initialized tenant cannot have its database option cleared", ((string[])(null)));
#line 96
this.ScenarioSetup(scenarioInfo);
#line 97
testRunner.Given("I have installed Orchard");
this.ScenarioSetup(scenarioInfo);
#line 98
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.Given("I have installed Orchard");
#line 99
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 100
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -329,12 +331,12 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
table7.AddRow(new string[] {
"RequestUrlHost",
"scott.example.org"});
#line 100
testRunner.And("I fill in", ((string)(null)), table7);
#line 104
testRunner.And("I hit \"Save\"");
#line 101
testRunner.And("I fill in", ((string)(null)), table7);
#line 105
testRunner.And("I go to \"/Setup\" on host scott.example.org");
testRunner.And("I hit \"Save\"");
#line 106
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line hidden
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -348,37 +350,39 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org");
table8.AddRow(new string[] {
"ConfirmPassword",
"6655321"});
#line 106
testRunner.And("I fill in", ((string)(null)), table8);
#line 111
testRunner.And("I hit \"Finish Setup\"");
#line 107
testRunner.And("I fill in", ((string)(null)), table8);
#line 112
testRunner.And("I go to \"/Admin/MultiTenancy/Edit/Scott\" on host localhost");
testRunner.And("I hit \"Finish Setup\"");
#line 113
testRunner.Then("I should see \"<h1>Edit Tenant</h1>\"");
testRunner.And("I go to \"/Admin/MultiTenancy/Edit/Scott\" on host localhost");
#line 114
testRunner.And("I should see \"<h2>Scott</h2>\"");
testRunner.Then("I should see \"<h1>Edit Tenant</h1>\"");
#line 115
testRunner.And("I should not see \"Allow the tenant to set up the database\"");
testRunner.And("I should see \"<h2>Scott</h2>\"");
#line 116
testRunner.And("I should not see \"Allow the tenant to set up the database\"");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Default tenant cannot be disabled")]
[NUnit.Framework.IgnoreAttribute()]
public virtual void DefaultTenantCannotBeDisabled()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default tenant cannot be disabled", ((string[])(null)));
#line 117
this.ScenarioSetup(scenarioInfo);
#line 118
testRunner.Given("I have installed Orchard");
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default tenant cannot be disabled", new string[] {
"ignore"});
#line 119
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
this.ScenarioSetup(scenarioInfo);
#line 120
testRunner.When("I go to \"Admin/MultiTenancy\"");
testRunner.Given("I have installed Orchard");
#line 121
testRunner.Then("I should not see \"<form action=\"/Admin/MultiTenancy/disable\"\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 122
testRunner.When("I go to \"Admin/MultiTenancy\"");
#line 123
testRunner.Then("I should not see \"<form action=\"/Admin/MultiTenancy/disable\"\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -388,14 +392,14 @@ testRunner.Then("I should not see \"<form action=\"/Admin/MultiTenancy/disable\"
public virtual void ARunningTenantCanBeDisabled()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A running tenant can be disabled", ((string[])(null)));
#line 123
this.ScenarioSetup(scenarioInfo);
#line 124
testRunner.Given("I have installed Orchard");
#line 125
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
this.ScenarioSetup(scenarioInfo);
#line 126
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.Given("I have installed Orchard");
#line 127
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 128
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -406,12 +410,12 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
table9.AddRow(new string[] {
"RequestUrlHost",
"scott.example.org"});
#line 127
testRunner.And("I fill in", ((string)(null)), table9);
#line 131
testRunner.And("I hit \"Save\"");
#line 132
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line 129
testRunner.And("I fill in", ((string)(null)), table9);
#line 133
testRunner.And("I hit \"Save\"");
#line 134
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line hidden
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -425,18 +429,18 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org");
table10.AddRow(new string[] {
"ConfirmPassword",
"6655321"});
#line 133
testRunner.And("I fill in", ((string)(null)), table10);
#line 138
testRunner.And("I hit \"Finish Setup\"");
#line 139
testRunner.And("I go to \"/Admin/MultiTenancy\" on host localhost");
#line 135
testRunner.And("I fill in", ((string)(null)), table10);
#line 140
testRunner.And("I hit \"Suspend\"");
testRunner.And("I hit \"Finish Setup\"");
#line 141
testRunner.And("I am redirected");
testRunner.And("I go to \"/Admin/MultiTenancy\" on host localhost");
#line 142
testRunner.Then("I should see \"<form action=\"/Admin/MultiTenancy/enable\"\"");
testRunner.And("I hit \"Suspend\"");
#line 143
testRunner.And("I am redirected");
#line 144
testRunner.Then("I should see \"<form action=\"/Admin/MultiTenancy/enable\"\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -446,14 +450,14 @@ testRunner.Then("I should see \"<form action=\"/Admin/MultiTenancy/enable\"\"");
public virtual void ARunningTenantWhichIsDisabledCanBeEnabled()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A running tenant which is disabled can be enabled", ((string[])(null)));
#line 144
this.ScenarioSetup(scenarioInfo);
#line 145
testRunner.Given("I have installed Orchard");
#line 146
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
this.ScenarioSetup(scenarioInfo);
#line 147
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.Given("I have installed Orchard");
#line 148
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 149
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -464,12 +468,12 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
table11.AddRow(new string[] {
"RequestUrlHost",
"scott.example.org"});
#line 148
testRunner.And("I fill in", ((string)(null)), table11);
#line 152
testRunner.And("I hit \"Save\"");
#line 153
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line 150
testRunner.And("I fill in", ((string)(null)), table11);
#line 154
testRunner.And("I hit \"Save\"");
#line 155
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -483,45 +487,47 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org");
table12.AddRow(new string[] {
"ConfirmPassword",
"6655321"});
#line 154
testRunner.And("I fill in", ((string)(null)), table12);
#line 159
testRunner.And("I hit \"Finish Setup\"");
#line 160
testRunner.And("I go to \"/Admin/MultiTenancy\" on host localhost");
#line 156
testRunner.And("I fill in", ((string)(null)), table12);
#line 161
testRunner.And("I hit \"Suspend\"");
testRunner.And("I hit \"Finish Setup\"");
#line 162
testRunner.And("I am redirected");
testRunner.And("I go to \"/Admin/MultiTenancy\" on host localhost");
#line 163
testRunner.And("I hit \"Resume\"");
testRunner.And("I hit \"Suspend\"");
#line 164
testRunner.And("I am redirected");
testRunner.And("I am redirected");
#line 165
testRunner.Then("I should see \"<form action=\"/Admin/MultiTenancy/disable\"\"");
testRunner.And("I hit \"Resume\"");
#line 166
testRunner.And("I am redirected");
#line 167
testRunner.Then("I should see \"<form action=\"/Admin/MultiTenancy/disable\"\"");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Listing tenants from command line")]
[NUnit.Framework.IgnoreAttribute()]
public virtual void ListingTenantsFromCommandLine()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Listing tenants from command line", ((string[])(null)));
#line 167
this.ScenarioSetup(scenarioInfo);
#line 168
testRunner.Given("I have installed Orchard");
#line 169
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Listing tenants from command line", new string[] {
"ignore"});
#line 170
testRunner.And("I have tenant \"Alpha\" on \"example.org\" as \"New-site-name\"");
this.ScenarioSetup(scenarioInfo);
#line 171
testRunner.When("I execute >tenant list");
testRunner.Given("I have installed Orchard");
#line 172
testRunner.Then("I should see \"Name: Alpha\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 173
testRunner.And("I should see \"Request Url Host: example.org\"");
testRunner.And("I have tenant \"Alpha\" on \"example.org\" as \"New-site-name\"");
#line 174
testRunner.When("I execute >tenant list");
#line 175
testRunner.Then("I should see \"Name: Alpha\"");
#line 176
testRunner.And("I should see \"Request Url Host: example.org\"");
#line hidden
testRunner.CollectScenarioErrors();
}

View File

@@ -6,8 +6,8 @@ Feature: Setup
Scenario: Root request shows setup form
Given I have a clean site with
| extension | names |
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
| theme | SafeMode |
When I go to "/Default.aspx"
Then I should see "Welcome to Orchard"
@@ -17,8 +17,8 @@ Scenario: Root request shows setup form
Scenario: Setup folder also shows setup form
Given I have a clean site with
| extension | names |
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
| theme | SafeMode |
When I go to "/Setup"
Then I should see "Welcome to Orchard"
@@ -28,8 +28,8 @@ Scenario: Setup folder also shows setup form
Scenario: Some of the initial form values are required
Given I have a clean site with
| extension | names |
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
| theme | SafeMode |
When I go to "/Setup"
And I hit "Finish Setup"
@@ -39,8 +39,8 @@ Scenario: Some of the initial form values are required
Scenario: Calling setup on a brand new install
Given I have a clean site with
| extension | names |
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Role, Orchard.Messagings, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
| theme | SafeMode, TheThemeMachine |
And I am on "/Setup"
When I fill in

View File

@@ -66,12 +66,12 @@ this.ScenarioSetup(scenarioInfo);
"names"});
table1.AddRow(new string[] {
"module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orc" +
"hard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
table1.AddRow(new string[] {
"core",
"Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Sc" +
"heduling, Settings, Shapes, XmlRpc"});
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
"ettings, Shapes, XmlRpc"});
table1.AddRow(new string[] {
"theme",
"SafeMode"});
@@ -102,12 +102,12 @@ this.ScenarioSetup(scenarioInfo);
"names"});
table2.AddRow(new string[] {
"module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orc" +
"hard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
table2.AddRow(new string[] {
"core",
"Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Sc" +
"heduling, Settings, Shapes, XmlRpc"});
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
"ettings, Shapes, XmlRpc"});
table2.AddRow(new string[] {
"theme",
"SafeMode"});
@@ -138,12 +138,12 @@ this.ScenarioSetup(scenarioInfo);
"names"});
table3.AddRow(new string[] {
"module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orc" +
"hard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
table3.AddRow(new string[] {
"core",
"Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Sc" +
"heduling, Settings, Shapes, XmlRpc"});
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
"ettings, Shapes, XmlRpc"});
table3.AddRow(new string[] {
"theme",
"SafeMode"});
@@ -176,13 +176,13 @@ this.ScenarioSetup(scenarioInfo);
"names"});
table4.AddRow(new string[] {
"module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orc" +
"hard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQu" +
"ery, TinyMce"});
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Role, Orchard.Messagings, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.W" +
"idgets, Orchard.jQuery, TinyMce"});
table4.AddRow(new string[] {
"core",
"Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Sc" +
"heduling, Settings, Shapes, XmlRpc"});
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
"ettings, Shapes, XmlRpc"});
table4.AddRow(new string[] {
"theme",
"SafeMode, TheThemeMachine"});

View File

@@ -30,6 +30,7 @@ using Orchard.Tests.ContentManagement;
using Orchard.Data.Providers;
using Orchard.Tests.FileSystems.AppData;
using Orchard.Tests.Modules.Migrations.Orchard.Tests.DataMigration.Records;
using Path = Bleroy.FluentPath.Path;
namespace Orchard.Tests.Modules.Migrations {
[TestFixture]
@@ -37,9 +38,10 @@ namespace Orchard.Tests.Modules.Migrations {
private IContainer _container;
private StubFolders _folders;
private ISchemaCommandGenerator _generator;
private ISessionFactory _sessionFactory;
private ISession _session;
private readonly Path _tempFixtureFolderName = Path.Get(System.IO.Path.GetTempPath()).Combine("Orchard.Tests.Modules.Migrations");
private Path _tempFolderName;
[TestFixtureSetUp]
public void CreateDb() {
@@ -51,9 +53,13 @@ namespace Orchard.Tests.Modules.Migrations {
typeof(ContentItemRecord),
typeof(ContentTypeRecord)};
var databaseFileName = System.IO.Path.GetTempFileName();
_tempFolderName = _tempFixtureFolderName.Combine(System.IO.Path.GetRandomFileName());
try {
_tempFixtureFolderName.Delete(true);
} catch {}
_tempFixtureFolderName.CreateDirectory();
_sessionFactory = DataUtility.CreateSessionFactory(
databaseFileName, types);
_tempFolderName, types);
var builder = new ContainerBuilder();
_folders = new StubFolders();
@@ -65,7 +71,7 @@ namespace Orchard.Tests.Modules.Migrations {
});
builder.RegisterInstance(new ShellSettings { Name = "Default", DataTablePrefix = "TEST", DataProvider = "SqlCe" });
builder.RegisterInstance(AppDataFolderTests.CreateAppDataFolder(Path.GetDirectoryName(databaseFileName))).As<IAppDataFolder>();
builder.RegisterInstance(AppDataFolderTests.CreateAppDataFolder(_tempFixtureFolderName)).As<IAppDataFolder>();
builder.RegisterType<SessionConfigurationCache>().As<ISessionConfigurationCache>();
builder.RegisterType<SqlCeDataServicesProvider>().As<IDataServicesProvider>();
builder.RegisterInstance(manager).As<IDataServicesProviderFactory>();
@@ -95,6 +101,12 @@ Features:
");
}
[TestFixtureTearDown]
public void Term() {
try { _tempFixtureFolderName.Delete(true); }
catch { }
}
public class StubFolders : IExtensionFolders {
public StubFolders() {
Manifests = new Dictionary<string, string>();

View File

@@ -69,6 +69,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\fluentnhibernate\FluentNHibernate.dll</HintPath>
</Reference>
<Reference Include="FluentPath">
<HintPath>..\..\lib\fluentpath\FluentPath.dll</HintPath>
</Reference>
<Reference Include="IronRuby, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\dlr\IronRuby.dll</HintPath>

View File

@@ -6,14 +6,16 @@ using Autofac;
using ClaySharp;
using NUnit.Framework;
using Orchard.Scripting.Services;
using Path = Bleroy.FluentPath.Path;
namespace Orchard.Tests.Scripting {
namespace Orchard.Tests.Modules.Scripting {
[TestFixture]
public class ScriptingTests {
private IContainer _container;
private IScriptingRuntime _scriptingRuntime;
private IScriptingManager _scriptingManager;
private string _tempFolderName;
private readonly Path _tempFixtureFolderName = Path.Get(System.IO.Path.GetTempPath()).Combine("Orchard.Tests.Modules.Scripting");
private Path _tempFolderName;
[SetUp]
public void Init() {
@@ -23,14 +25,18 @@ namespace Orchard.Tests.Scripting {
_container = builder.Build();
_scriptingRuntime = _container.Resolve<IScriptingRuntime>();
_scriptingManager = _container.Resolve<IScriptingManager>();
_tempFolderName = Path.GetTempFileName();
File.Delete(_tempFolderName);
Directory.CreateDirectory(_tempFolderName);
_tempFolderName = _tempFixtureFolderName.Combine(System.IO.Path.GetRandomFileName());
try {
_tempFolderName.Delete();
}
catch { }
_tempFolderName.CreateDirectory();
}
[TearDown]
public void Term() {
Directory.Delete(_tempFolderName, true);
try { _tempFixtureFolderName.Delete(true); }
catch { }
}
[Test]
@@ -71,7 +77,7 @@ namespace Orchard.Tests.Scripting {
[Test]
public void ScriptingManagerCanExecuteFile() {
var targetPath = Path.Combine(_tempFolderName, "SampleMethodDefinition.rb");
var targetPath = _tempFolderName.Combine("SampleMethodDefinition.rb");
File.WriteAllText(targetPath, "def f\r\nreturn 32\r\nend\r\n");
_scriptingManager.ExecuteFile(targetPath);
Assert.That(_scriptingManager.ExecuteExpression("f / 4"), Is.EqualTo(8));
@@ -95,7 +101,7 @@ namespace Orchard.Tests.Scripting {
[Test]
public void CanDeclareCallbackOnInstanceEvalWithFile() {
var targetPath = Path.Combine(_tempFolderName, "CallbackOnInstanceEval.rb");
var targetPath = _tempFolderName.Combine("CallbackOnInstanceEval.rb");
File.WriteAllText(targetPath, "class ExecContext\r\ndef initialize(callbacks)\r\n@callbacks = callbacks;\r\nend\r\ndef execute(text)\r\ninstance_eval(text.to_s);\r\nend\r\ndef method_missing(name, *args, &block)\r\n@callbacks.send(name, args, &block);\r\nend\r\nend\r\ndef execute(&block)\r\nExecContext.new(callbacks).instance_eval(&block);\r\nend\r\n");
_scriptingManager.ExecuteFile(targetPath);
_scriptingManager.SetVariable("callbacks", new CallbackApi());