diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs
index 99e439472..e937993f9 100644
--- a/src/Orchard.Specs/Bindings/WebAppHosting.cs
+++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs
@@ -157,9 +157,26 @@ namespace Orchard.Specs.Bindings {
foreach (var row in table.Rows) {
var r = row;
- var input = inputs.SingleOrDefault(x => x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]);
+ var input = inputs.First(x => x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]);
Assert.That(input, Is.Not.Null, "Unable to locate name {0} in page html:\r\n\r\n{1}", r["name"], Details.ResponseText);
- input.Attributes.Add("value", row["value"]);
+ var inputType = input.Attributes["type"].Value.ToLowerInvariant();
+ switch(inputType) {
+ case "radio":
+ var radios = inputs.Where(
+ x =>
+ x.GetAttributeValue("type", "") == "radio" &&
+ x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]);
+ foreach(var radio in radios) {
+ if (radio.GetAttributeValue("value", "") == row["value"])
+ radio.Attributes.Add("checked", "checked");
+ else if (radio.Attributes.Contains("checked"))
+ radio.Attributes.Remove("checked");
+ }
+ break;
+ default:
+ input.Attributes.Add("value", row["value"]);
+ break;
+ }
}
}
@@ -203,6 +220,11 @@ namespace Orchard.Specs.Bindings {
Assert.That(Details.ResponseText, Is.StringContaining(text));
}
+ [Then(@"I should not see ""(.*)""")]
+ public void ThenIShouldNotSee(string text) {
+ Assert.That(Details.ResponseText, Is.Not.StringContaining(text));
+ }
+
[Then(@"the title contains ""(.*)""")]
public void ThenTheTitleContainsText(string text) {
ScenarioContext.Current.Pending();
diff --git a/src/Orchard.Specs/MultiTenancy.feature b/src/Orchard.Specs/MultiTenancy.feature
index 39f5e40ec..e0f8252e0 100644
--- a/src/Orchard.Specs/MultiTenancy.feature
+++ b/src/Orchard.Specs/MultiTenancy.feature
@@ -41,7 +41,7 @@ Scenario: A new tenant is created with uninitialized state
And I am redirected
Then I should see "
"
And the status should be 200 OK
-
+
Scenario: A new tenant goes to the setup screen
Given I have installed Orchard
And I have installed "Orchard.MultiTenancy"
@@ -55,6 +55,23 @@ Scenario: A new tenant goes to the setup screen
Then I should see "Welcome to Orchard"
And I should see "Finish Setup"
And the status should be 200 OK
+
+Scenario: A new tenant with preconfigured database goes to the setup screen
+ Given I have installed Orchard
+ And I have installed "Orchard.MultiTenancy"
+ When I go to "Admin/MultiTenancy/Add"
+ And I fill in
+ | name | value |
+ | Name | Scott |
+ | RequestUrlHost | scott.example.org |
+ | DatabaseOptions | True |
+ And I hit "Save"
+ And I am redirected
+ And I go to "/Setup" on host scott.example.org
+ Then I should see "Welcome to Orchard"
+ And I should see "Finish Setup"
+ And I should not see "SQLite"
+ And the status should be 200 OK
Scenario: A new tenant runs the setup
Given I have installed Orchard
diff --git a/src/Orchard.Specs/MultiTenancy.feature.cs b/src/Orchard.Specs/MultiTenancy.feature.cs
index 765f83947..73d8a51ae 100644
--- a/src/Orchard.Specs/MultiTenancy.feature.cs
+++ b/src/Orchard.Specs/MultiTenancy.feature.cs
@@ -202,10 +202,10 @@ this.ScenarioSetup(scenarioInfo);
}
[NUnit.Framework.TestAttribute()]
- [NUnit.Framework.DescriptionAttribute("A new tenant runs the setup")]
- public virtual void ANewTenantRunsTheSetup()
+ [NUnit.Framework.DescriptionAttribute("A new tenant with preconfigured database goes to the setup screen")]
+ public virtual void ANewTenantWithPreconfiguredDatabaseGoesToTheSetupScreen()
{
- TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant runs the setup", ((string[])(null)));
+ 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
@@ -224,31 +224,77 @@ this.ScenarioSetup(scenarioInfo);
table4.AddRow(new string[] {
"RequestUrlHost",
"scott.example.org"});
+ table4.AddRow(new string[] {
+ "DatabaseOptions",
+ "True"});
#line 63
testRunner.And("I fill in", ((string)(null)), table4);
-#line 67
- testRunner.And("I hit \"Save\"");
#line 68
+ testRunner.And("I hit \"Save\"");
+#line 69
+ testRunner.And("I am redirected");
+#line 70
testRunner.And("I go to \"/Setup\" on host scott.example.org");
+#line 71
+ testRunner.Then("I should see \"Welcome to Orchard\"");
+#line 72
+ testRunner.And("I should see \"Finish Setup\"");
+#line 73
+ testRunner.And("I should not see \"SQLite\"");
+#line 74
+ testRunner.And("the status should be 200 OK");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("A new tenant runs the setup")]
+ 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");
+#line 78
+ testRunner.And("I have installed \"Orchard.MultiTenancy\"");
+#line 79
+ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table5.AddRow(new string[] {
+ "Name",
+ "Scott"});
+ 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 85
+ testRunner.And("I go to \"/Setup\" on host scott.example.org");
+#line hidden
+ TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table6.AddRow(new string[] {
"SiteName",
"Scott Site"});
- table5.AddRow(new string[] {
+ table6.AddRow(new string[] {
"AdminPassword",
"6655321"});
-#line 69
- testRunner.And("I fill in", ((string)(null)), table5);
-#line 73
+#line 86
+ testRunner.And("I fill in", ((string)(null)), table6);
+#line 90
testRunner.And("I hit \"Finish Setup\"");
-#line 74
+#line 91
testRunner.And("I go to \"/Default.aspx\"");
-#line 75
+#line 92
testRunner.Then("I should see \"
Scott Site
\"");
-#line 76
+#line 93
testRunner.And("I should see \"Welcome, admin!\"");
#line hidden
testRunner.CollectScenarioErrors();
@@ -259,19 +305,19 @@ this.ScenarioSetup(scenarioInfo);
public virtual void ListingTenantsFromCommandLine()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Listing tenants from command line", ((string[])(null)));
-#line 78
+#line 95
this.ScenarioSetup(scenarioInfo);
-#line 79
+#line 96
testRunner.Given("I have installed Orchard");
-#line 80
+#line 97
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
-#line 81
+#line 98
testRunner.And("I have tenant \"Alpha\" on \"example.org\" as \"New-site-name\"");
-#line 82
+#line 99
testRunner.When("I execute >tenant list");
-#line 83
+#line 100
testRunner.Then("I should see \"Name: Alpha\"");
-#line 84
+#line 101
testRunner.And("I should see \"Request Url Host: example.org\"");
#line hidden
testRunner.CollectScenarioErrors();