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);
}
");
        }
Example #2
0
        public void SingleTag()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
@tag
Scenario: Tagged
");
            FeatureRunner.The_Runner_should_contain(
                @"
[TestMethod]
[TestCategory(""tag"")]
public void Tagged()
{
}
");
        }
Example #3
0
        public void IgnoreAScenario()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
@ignore
Scenario: Ignored
");
            FeatureRunner.The_Runner_should_contain(
                @"
[TestMethod]
[Ignore]
public void Ignored()
{
}
");
        }
Example #4
0
        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();
}
");
        }
Example #5
0
        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}
);
}
");
        }
Example #6
0
        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}
);
}
");
        }
Example #7
0
        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();
}
");
        }
Example #8
0
        public void GenerateArguments()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
Scenario: Scenario Name
If ""X"" happens
");
            FeatureRunner.The_Runner_should_contain(
                @"
If__happens(""X"");
");
        }
Example #9
0
        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();
}
");
        }
Example #11
0
        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"");
");
        }