Skip to content

Instantly share code, notes, and snippets.

@JakeGinnivan
Created April 1, 2014 15:50
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/9916947 to your computer and use it in GitHub Desktop.
Save JakeGinnivan/9916947 to your computer and use it in GitHub Desktop.
public class ReflectiveExamples
{
public int Start { get; set; }
public int Eat { get; set; }
public int Left { get; set; }
//Scenario Outline: eating
// Given there are <start> cucumbers
// When I eat <eat> cucumbers
// Then I should have <left> cucumbers
public void GivenThereAre__Start__Cucumbers()
{
// Do nothing, BDDfy will set Start for us
}
[Step(Title="When I eat <eat> cucumbers")]
public void WhenIEatCucumbers(int eat)
{
_result = Start - Eat;
}
[Step(Title="Then I should have <left> cucumbers")]
public void ThenIShouldHaveCucumbersLeft()
{
_result.ShouldBe(Left);
}
[DataHeader("Start", "Eat", "Left")]
public IEnumerable<object[]> WithExamples()
{
yield return new[] { 12, 5, 7 };
yield return new[] { 20, 5, 15 };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment