Added MultiTenancy spec test for tenant w/ preconfigured db

- Also updated the WebAppHosting binding's form filler to select the appropriate radio input based on given value

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-05-11 12:30:49 -07:00
parent 688fb2bdbb
commit 198060d3e4
3 changed files with 107 additions and 22 deletions

View File

@@ -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 <input> 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();