Created
April 1, 2014 10:41
-
-
Save JakeGinnivan/9911663 to your computer and use it in GitHub Desktop.
BDDfy Fluent Examples Ideas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/cucumber/cucumber/wiki/Scenario-Outlines | |
//Scenario: eat 5 out of 20 | |
// Given there are 20 cucumbers | |
// When I eat 5 cucumbers | |
// Then I should have 15 cucumbers | |
//Scenario Outline: eating | |
// Given there are <start> cucumbers | |
// When I eat <eat> cucumbers | |
// Then I should have <left> cucumbers | |
this.Given(_ => _.Start, "Given there are {0} cucumbers") | |
.When(_ => _.Eat, "When I eat {0} cucumbers") | |
.Then(_ => _.Left, "Then I should have {0} cucumbers") | |
.WithExamples(()=> | |
@" | |
| start | eat | left | | |
| 12 | 5 | 7 | | |
| 20 | 5 | 15 | | |
") | |
.BDDfy(); | |
this.Given(_ => _.Start, "Given there are {0} cucumbers") | |
.When(_ => _.Eat, "When I eat {0} cucumbers") | |
.Then(_ => _.Left, "Then I should have {0} cucumbers") | |
.WithExamples(()=> | |
{ | |
yield return new FluentExample(12, 5, 7); | |
yield return new FluentExample(20, 5, 15); | |
}) | |
.BDDfy(); | |
this.Given(_ => _.Start, "Given there are {0} cucumbers") | |
.When(_ => _.Eat, "When I eat {0} cucumbers") | |
.Then(_ => _.Left, "Then I should have {0} cucumbers") | |
.WithExamples(()=> new Examples<FluentExamples>(_ => _.Start, _ => _.Eat, _ => _.Left) | |
{ | |
new[] { 12, 5, 7 }, | |
new[] { 20, 5, 15 } | |
}) | |
.BDDfy(); | |
this.Given(_ => _.Start, "Given there are {0} cucumbers") | |
.When(_ => _.Eat, "When I eat {0} cucumbers") | |
.Then(_ => _.Left, "Then I should have {0} cucumbers") | |
.WithExamples( | |
new[] { "Start", "Eat", "Left" }, | |
new[] { 12, 5, 7 }, | |
new[] { 20, 5, 15 }) | |
.BDDfy(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment