Skip to content

Instantly share code, notes, and snippets.

@syed-afraz-ali
Created May 24, 2016 05:03
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 syed-afraz-ali/f627a24a6512c64ec29ca6961124ab64 to your computer and use it in GitHub Desktop.
Save syed-afraz-ali/f627a24a6512c64ec29ca6961124ab64 to your computer and use it in GitHub Desktop.
BDDfy examples feature usage
public class ExamplesUsage
{
private Int32 _initial;
private Int32 _eat;
[Given("Given there are <initial> cucumbers")]
private void Given(Int32 initial)
{
_initial = initial;
}
[Given("When I eat <eat> of them")]
private void When(Int32 eat)
{
_eat = eat;
}
[Then("When I should have <left> left")]
private void Then(Int32 left)
{
(_initial - _eat).ShouldBe(left);
}
[TestCase]
public void Execute()
{
this.WithExamples(
new ExampleTable("initial", "eat", "left")
{
{12, 5, 7},
{20, 5, 15}
}).BDDfy();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment