public void UsingScenarioOutlines() { FeatureRunner.Given_the_Feature_contains( @" Scenario: Interest Rate Given ""account"" has ""amount"" When interest is calculated It should be ""interest"" Examples: [account|amount|interest] |23 |42 |1 | |56 |23 |3 | "); FeatureRunner.The_Runner_should_contain( @" [TestMethod] public void InterestRate_1() { Given__has(23, 42); When_interest_is_calculated(); It_should_be(1); } [TestMethod] public void InterestRate_2() { Given__has(56, 23); When_interest_is_calculated(); It_should_be(3); } "); }
public void SingleTag() { FeatureRunner.Given_the_Feature_contains( @" @tag Scenario: Tagged "); FeatureRunner.The_Runner_should_contain( @" [TestMethod] [TestCategory(""tag"")] public void Tagged() { } "); }
public void IgnoreAScenario() { FeatureRunner.Given_the_Feature_contains( @" @ignore Scenario: Ignored "); FeatureRunner.The_Runner_should_contain( @" [TestMethod] [Ignore] public void Ignored() { } "); }
public void SingleLineComments() { FeatureRunner.Given_the_Feature_contains( @" Scenario: The Doors // When the doors of perception are cleansed, // man will see things as they truly are Infinite "); FeatureRunner.The_Runner_should_contain( @" public void TheDoors() { Infinite(); } "); }
public void SingleColumnTableBecomesAnArrayArg() { FeatureRunner.Given_the_Feature_contains( @" Scenario: Scenario Name Given some values: |0| |1| "); FeatureRunner.The_Runner_should_contain( @" [TestMethod] public void ScenarioName() { Given_some_values_ ( new[] {0, 1} ); } "); }
public void UsingTables() { FeatureRunner.Given_the_Feature_contains( @" Scenario: Scenario Name Given some values: |0|0| |0|1| "); FeatureRunner.The_Runner_should_contain( @" [TestMethod] public void ScenarioName() { Given_some_values_ ( new[] {0, 0}, new[] {0, 1} ); } "); }
public void DefaultStepDefinition() { FeatureRunner.Given_the_Feature_is( @" Feature: Reusing Steps Scenario: Reuse a Step Step "); FeatureRunner.The_Runner_should_contain( @" [TestMethod] public void ReuseAStep() { Step(); } "); }
public void GenerateArguments() { FeatureRunner.Given_the_Feature_contains( @" Scenario: Scenario Name If ""X"" happens "); FeatureRunner.The_Runner_should_contain( @" If__happens(""X""); "); }
public void QueVivaEspaña_YOlé_() { Select_language("es"); FeatureRunner.Given_the_Feature_is( @" Funcionalidad: Multilingue Escenario: En Español "); FeatureRunner.The_Runner_should_contain( @" [TestClass] public partial class Multilingue { [TestMethod] public void EnEspañol() { } } "); }
public void GenerateTestMethods() { FeatureRunner.Given_the_Feature_contains( @" Scenario: Scenario Name If something happens Then something else should happen If something happens And another thing too "); FeatureRunner.The_Runner_should_contain( @" [TestMethod] public void ScenarioName() { If_something_happens(); Then_something_else_should_happen(); If_something_happens(); And_another_thing_too(); } "); }
public void SimpleArgs() { FeatureRunner.Given_the_Feature_is( @" Feature: Arg Types Scenario: Use string instead of int Given the zipcode is ""33131"" "); FeatureRunner.The_Runner_should_contain( @" Given_the_zipcode_is(""33131""); "); }