Setup submit scenario works

Minimum modules are copied
Form is submitted
Redirect is verified (should have a step to follow redirect)
Also changed .Named to .Keyed in a controller test

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-04-20 15:07:00 -07:00
parent ef8e3d4cce
commit 31995c55ca
6 changed files with 85 additions and 39 deletions

View File

@@ -61,19 +61,21 @@ namespace Orchard.Specs.Bindings {
public void GivenIHaveACleanSiteWith(Table table) {
GivenIHaveACleanSite();
foreach (var row in table.Rows) {
switch (row["extension"]) {
case "core":
GivenIHaveCore(row["name"]);
break;
case "module":
GivenIHaveModule(row["name"]);
break;
case "theme":
GivenIHaveTheme(row["name"]);
break;
default:
Assert.Fail("Unknown extension type {0}", row["extension"]);
break;
foreach (var name in row["names"].Split(',').Select(x => x.Trim())) {
switch (row["extension"]) {
case "core":
GivenIHaveCore(name);
break;
case "module":
GivenIHaveModule(name);
break;
case "theme":
GivenIHaveTheme(name);
break;
default:
Assert.Fail("Unknown extension type {0}", row["extension"]);
break;
}
}
}
}
@@ -105,13 +107,12 @@ namespace Orchard.Specs.Bindings {
[When(@"I fill in")]
public void WhenIFillIn(Table table) {
var inputs = _doc.DocumentNode
.SelectNodes("//input");
.SelectNodes("//input") ?? Enumerable.Empty<HtmlNode>();
foreach (var row in table.Rows) {
var r = row;
var input = inputs.Single(
x => x.Attributes.Contains("name") &&
x.Attributes["name"].Value == r["name"]);
var input = inputs.SingleOrDefault(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"]);
}
}