Skip to content

Instantly share code, notes, and snippets.

@JakeGinnivan
Created April 1, 2014 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JakeGinnivan/9911663 to your computer and use it in GitHub Desktop.
Save JakeGinnivan/9911663 to your computer and use it in GitHub Desktop.
BDDfy Fluent Examples Ideas
//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