コード例 #1
0
        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);
}
");
        }
コード例 #2
0
        public void SingleLineComments()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
Scenario: Name
// Comment
Step
// Scenario:
");
            HighlightFeature.Raconteur_should_highlight(1, "// Comment", "Comment");
            HighlightFeature.Raconteur_should_highlight(1, "// Scenario:", "Comment");
            HighlightFeature.Raconteur_should_highlight(1, "Scenario:", "Keyword");
        }
コード例 #3
0
ファイル: Tags.runner.cs プロジェクト: tlayte/raconteur
        public void SingleTag()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
@tag
Scenario: Tagged
");
            FeatureRunner.The_Runner_should_contain(
                @"
[TestMethod]
[TestCategory(""tag"")]
public void Tagged()
{
}
");
        }
コード例 #4
0
        public void TableValuesAreDisplayedLikeStrings()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
Scenario: Name

Step with Table
[ X | Y ]
| a | b |
| c | d |
");
            HighlightFeature.Raconteur_should_highlight_like_a("String", "a");
            HighlightFeature.Raconteur_should_highlight_like_a("String", "d");
            HighlightFeature.Raconteur_should_highlight_like_a("String", "b");
            HighlightFeature.Raconteur_should_highlight_like_a("String", "c");
        }
コード例 #5
0
        public void IgnoreAScenario()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
@ignore
Scenario: Ignored
");
            FeatureRunner.The_Runner_should_contain(
                @"
[TestMethod]
[Ignore]
public void Ignored()
{
}
");
        }
コード例 #6
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();
}
");
        }
コード例 #7
0
ファイル: Tags.runner.cs プロジェクト: tlayte/raconteur
        public void HighlightAllTags()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
@tag @tag
@multiword tag
Scenario: Name
");
            HighlightFeature.Raconteur_should_highlight_like_a("Comment", 1, "@tag @tag");
            HighlightFeature.Raconteur_should_highlight_like_a("Comment", 1, "@multiword tag");
        }
コード例 #8
0
        public void ReusingStepDefinitions()
        {
            FeatureRunner.Given_the_setting__contains("Libraries", "Common");
            FeatureRunner.Given_the_Feature_contains(
                @"
using Step Definitions

Scenario: Reuse a Step
Step from Step Definitions
");
            FeatureRunner.The_Runner_should_contain(
                @"
public StepDefinitions StepDefinitions = new StepDefinitions();

[TestMethod]
public void ReuseAStep()
{
StepDefinitions.Step_from_Step_Definitions();
}
");
        }
コード例 #9
0
        public void TablesInExternalStepDefinitions()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
using Arg Types
Scenario: Use string instead of int in table
Given the Board
|0| | |
| |X| |
| | |X|
");
            FeatureRunner.The_Runner_should_contain(
                @"
Given_the_Board
(
new[] {""0"", """", """"},
new[] {"""", ""X"", """"},
new[] {"""", """", ""X""}
);
");
        }
コード例 #10
0
ファイル: Tables.runner.cs プロジェクト: tlayte/raconteur
        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}
);
}
");
        }
コード例 #11
0
        public void StepWithinFeature()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
Scenario: Name
old Step
old Step
");
            When__is_renamed_to("old Step", "new Step");
            The_Feature_should_contain(
                @"
Scenario: Name
new Step
new Step
");
        }
コード例 #12
0
ファイル: EdgeCases.runner.cs プロジェクト: tlayte/raconteur
        public void Keywords_Comments_TablesInMultilineArgDisplayLikeArg()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
""
Scenario: Name
// Single Line Comment
/*
MultiLine Comment
*/
[ Table			  ]
|  value in table |
""
");
            HighlightFeature.Raconteur_should_highlight_like_a("String",
                                                               @"
""
Scenario: Name
// Single Line Comment
/*
MultiLine Comment
*/
[ Table			  ]
|  value in table |
""
");
            HighlightFeature.Raconteur_should_not_highlight("Scenario:");
            HighlightFeature.Raconteur_should_not_highlight("// Single Line Comment");
            HighlightFeature.Raconteur_should_not_highlight("value in table");
            HighlightFeature.Raconteur_should_not_highlight(
                @"
/*
MultiLine Comment
*/
");
        }
コード例 #13
0
        public void GenerateArguments()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
Scenario: Scenario Name
If ""X"" happens
");
            FeatureRunner.The_Runner_should_contain(
                @"
If__happens(""X"");
");
        }
コード例 #14
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}
);
}
");
        }
コード例 #15
0
        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();
}
");
        }
コード例 #16
0
        public void ScenariosAreCollapsible()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
Scenario: First
Steps
Scenario: Second
Step1
Step2
");
            Raconteur_should_allow_to_collapse(
                @"
Scenario: First
Steps
");
            Raconteur_should_allow_to_collapse(
                @"
Scenario: Second
Step1
Step2
");
        }
コード例 #17
0
        public void Completion_1()
        {
            FeatureRunner.Given_the_Feature_contains(
                @"
Scenario: Scenario Name
I do something
I do another thing
If something happens
Then this should happen
Do an ""arg"" thing
");
            When_I_begin_to_type__on_the_next_line("Sc");
            Then__should_be_displayed("Scenario:");
        }