Exemplo n.º 1
0
 public void AddFeature(FeatureViewModel featureViewModel)
 {
     string path = featureViewModel.FeatureNode.SourceFile.Replace('\\', '/');
     var bisected = path.BisectLast("/");
     var folder = bisected.Length == 2 ? bisected[0] : "";
     RootFolder.SubFolder(folder, true).Features.Add(featureViewModel);
 }
Exemplo n.º 2
0
        public ResultsMatcher()
        {
            AddFeature(@"Feature: Backgrounds and scenario tables
            In order to avoid silly mistakes
            As a math idiot
            I want to be told the sum of two numbers

            Background:
            Given I have entered 1 into the calculator

            @passes
            Scenario Outline: Add two correct numbers with scenario outlines / table
            And I have entered <number2> into the calculator
            When I press add
            Then the result should be <result> on the screen

            Scenarios:
               | number2 | result |
               | 2       | 3      |
               | 4       | 5      |
               | -2      | -1     |

            @fails
            Scenario Outline: Add two incorrect numbers with scenario outlines / table
            And I have entered <number2> into the calculator
            When I press add
            Then the result should be <result> on the screen

            Scenarios:
            | number2 | result |
            | 2       | 3      |
            | five    | 144    |
            | -2      | 144    |

            ", "AdvancedFormatting/BackgroundsAndScenarioTables.feature");

            AddFeature(@"Feature: Failing Feature
            In order to avoid silly mistakes
            As a math idiot
            I want to be told the sum of two numbers

            @mytag
            Scenario: Add two correct numbers
            Given I have entered 50 into the calculator
            And I have entered 70 into the calculator
            When I press add
            Then the result should be 120 on the screen

            @tables
            Scenario Outline: Add two correct numbers with scenario outlines / table
            Given I have entered <number1> into the calculator
            And I have entered <number2> into the calculator
            When I press add
            Then the result should be <result> on the screen
            Scenarios:
            |number1|number2|result|
            |1|2|3|
            |4|4|8|
            |3|-2|1|

            @mytag
            Scenario: Add two incorrect numbers
            Given I have entered 50 into the calculator
            And I have entered 70 into the calculator
            When I press add
            Then the result should be 1 on the screen

            @tables
            Scenario Outline: Add two incorrect numbers with scenario outlines / table
            Given I have entered <number1> into the calculator
            And I have entered <number2> into the calculator
            When I press add
            Then the result should be <result> on the screen
            Scenarios:
            |number1|number2|result|
            |1|2|5|
            |4|4|5|
            |3|-2|5|", "FailingFeature.feature");

            AddFeature(@"Feature: Unknown Feature
            In order to avoid silly mistakes
            As a math idiot
            I want to be told the sum of two numbers

            Scenario: Add two correct numbers
            Given I have entered 50 into the calculator
            And I have entered 70 into the calculator
            When I press add
            Then the result should be 120 on the screen
             ", "UnknownFeature.feature");

            new XUnitResultsMatcher().Populate(File.OpenRead("xunitOutput.xml"), _viewModel);
            _failingFeature = _viewModel.Feature("Failing Feature");
            _unknownFeature = _viewModel.Feature("Unknown Feature");
            _backgroundsAndScenarioTables = _viewModel.Feature("Backgrounds and scenario tables");
        }