public void InputGeneratorCreatesMultipleHooks()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "@f1@f2 @f3",
                "@f4",
                "Feature: my new feature",
                "",
                "@s1@s2 @s3",
                "@s4",
                "Scenario: my new scenario"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(4, features[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("f1", features[0].Hooks[0].Name);
            Assert.AreEqual("f2", features[0].Hooks[1].Name);
            Assert.AreEqual("f3", features[0].Hooks[2].Name);
            Assert.AreEqual("f4", features[0].Hooks[3].Name);
            Assert.AreEqual(8, features[0].Scenarios[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("f1", features[0].Scenarios[0].Hooks[0].Name);
            Assert.AreEqual("f2", features[0].Scenarios[0].Hooks[1].Name);
            Assert.AreEqual("f3", features[0].Scenarios[0].Hooks[2].Name);
            Assert.AreEqual("f4", features[0].Scenarios[0].Hooks[3].Name);
            Assert.AreEqual("s1", features[0].Scenarios[0].Hooks[4].Name);
            Assert.AreEqual("s2", features[0].Scenarios[0].Hooks[5].Name);
            Assert.AreEqual("s3", features[0].Scenarios[0].Hooks[6].Name);
            Assert.AreEqual("s4", features[0].Scenarios[0].Hooks[7].Name);
        }
        public void InputGeneratorCreatesOneExamplesTable()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario Outline: my new scenario outline",
                "\tGiven I have a step",
                "",
                "Examples:",
                "\t| a | b | c |",
                "\t| 1 | 2 | 3 |"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios.Count, "scenario count mismatch");
            Assert.IsNotNull(((NodeScenarioOutline)features[0].Scenarios[0]).Examples);
            Assert.AreEqual(2, ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows.Count, "examples row count mismatch");
            Assert.AreEqual("a", ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows[0][0]);
            Assert.AreEqual("b", ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows[0][1]);
            Assert.AreEqual("c", ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows[0][2]);
            Assert.AreEqual("1", ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows[1][0]);
            Assert.AreEqual("2", ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows[1][1]);
            Assert.AreEqual("3", ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows[1][2]);
        }
        public void InputGeneratorParameterizesFromExampleTable()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario Outline: my new scenario outline",
                "\tGiven I have a step with example data '<a>'",
                "\tGiven I have a step with example data <b>",
                "",
                "Examples:",
                "\t| a | b | c |",
                "\t| 1 | 2 | 3 |"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.IsTrue(features[0].Scenarios[0].Steps[0].Parameters[0].IsFromExampleTable, "parameter not from example table");
            Assert.AreEqual("p0", features[0].Scenarios[0].Steps[0].Parameters[0].Name);
            Assert.AreEqual("a", features[0].Scenarios[0].Steps[0].Parameters[0].Value);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps[1].Parameters.Count, "parameter count mismatch");
            Assert.IsTrue(features[0].Scenarios[0].Steps[1].Parameters[0].IsFromExampleTable, "parameter not from example table");
            Assert.AreEqual("p0", features[0].Scenarios[0].Steps[1].Parameters[0].Name);
            Assert.AreEqual("b", features[0].Scenarios[0].Steps[1].Parameters[0].Value);
        }
        public void InputGeneratorCreatesSecondFeatureWithHook()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "@f1",
                "Feature: feature1",
                "",
                "@s1",
                "Scenario: scenario1",
                "",
                "@f2",
                "Feature: feature2",
                "",
                "@s2",
                "Scenario: scenario2",
            };
            var features = generator.Load(contents);

            Assert.AreEqual(2, features.Count, "feature count mismatch");

            VerifyFeature(features[0], "1");

            VerifyFeature(features[1], "2");
        }
        public void InputGeneratorCreatesMultipleHooks()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "@f1@f2 @f3",
                "@f4",
                "Feature: my new feature",
                "",
                "@s1@s2 @s3",
                "@s4",
                "Scenario: my new scenario"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(4, features[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("f1", features[0].Hooks[0].Name);
            Assert.AreEqual("f2", features[0].Hooks[1].Name);
            Assert.AreEqual("f3", features[0].Hooks[2].Name);
            Assert.AreEqual("f4", features[0].Hooks[3].Name);
            Assert.AreEqual(8, features[0].Scenarios[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("f1", features[0].Scenarios[0].Hooks[0].Name);
            Assert.AreEqual("f2", features[0].Scenarios[0].Hooks[1].Name);
            Assert.AreEqual("f3", features[0].Scenarios[0].Hooks[2].Name);
            Assert.AreEqual("f4", features[0].Scenarios[0].Hooks[3].Name);
            Assert.AreEqual("s1", features[0].Scenarios[0].Hooks[4].Name);
            Assert.AreEqual("s2", features[0].Scenarios[0].Hooks[5].Name);
            Assert.AreEqual("s3", features[0].Scenarios[0].Hooks[6].Name);
            Assert.AreEqual("s4", features[0].Scenarios[0].Hooks[7].Name);
        }
        public void InputGeneratorHandlesLeadingNumbersInFeatureName()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: 123:Abc123_-~!@#$%^&*()[].,"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("_23Abc123", features[0].Name);
        }
        public void InputGeneratorHandlesInvalidCharactersInFeatureName()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: :Abc123_-~!@#$%^&*()[].,"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("Abc123", features[0].Name);
        }
        public void InputGeneratorCreatesOneFeatureWithoutScenarios()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features.Count, "feature count mismatch");
            Assert.AreEqual(0, features[0].Scenarios.Count, "scenario count mismatch");
            Assert.AreEqual("MyNewFeature", features[0].Name);
        }
        public void InputGeneratorHandlesInvalidCharactersInScenarioName()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: :Abc123_-~!@#$%^&*()[].,"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("Abc123", features[0].Scenarios[0].Name);
        }
        public void InputGeneratorHandlesLeadingNumbersInScenarioName()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: 123:Abc123_-~!@#$%^&*()[].,"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("_23Abc123", features[0].Scenarios[0].Name);
        }
示例#11
0
        public void InputGeneratorCreatesOneFeatureWithoutScenarios()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features.Count, "feature count mismatch");
            Assert.AreEqual(0, features[0].Scenarios.Count, "scenario count mismatch");
            Assert.AreEqual("MyNewFeature", features[0].Name);
        }
        public void InputGeneratorCreatesOneScenarioWithoutSteps()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("MyNewScenario", features[0].Scenarios[0].Name);
            Assert.AreEqual(0, features[0].Scenarios[0].Steps.Count, "step count mismatch");
        }
示例#13
0
        public void InputGeneratorCreatesOneScenarioOutlineWithoutSteps()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario Outline: my new scenario outline"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("MyNewScenarioOutline", features[0].Scenarios[0].Name);
            Assert.AreEqual(0, features[0].Scenarios[0].Steps.Count, "step count mismatch");
        }
        public void InputGeneratorHandlesInvalidCharactersInStepName()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven :Abc123_-~!@#$%^&*()[].,",
            };
            var features = generator.Load(contents);

            Assert.AreEqual("GivenAbc123", features[0].Scenarios[0].Steps[0].Name);
        }
        public void InputGeneratorCreatesOneStep()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStep", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(0, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
        }
        public void InputGeneratorCreatesOneStep()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStep", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(0, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
        }
        public void InputGeneratorCreatesOneFeatureHook()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "@feature",
                "Feature: my new feature",
                "",
                "Scenario: my new scenario"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("feature", features[0].Hooks[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Hooks.Count, "scenario hook count mismatch");
            Assert.AreEqual("feature", features[0].Scenarios[0].Hooks[0].Name);
        }
        public void InputGeneratorCreatesOneStepWithOneParameterThatHasSpaces()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with one 'parameter that has spaces'"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStepWithOne", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("parameter that has spaces", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
        }
        public void InputGeneratorCreatesOneFeatureHook()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "@feature",
                "Feature: my new feature",
                "",
                "Scenario: my new scenario"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("feature", features[0].Hooks[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Hooks.Count, "scenario hook count mismatch");
            Assert.AreEqual("feature", features[0].Scenarios[0].Hooks[0].Name);
        }
        public void InputGeneratorCreatesOneStepWithOneParameterInTheMiddle()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with one 'parameter' in the middle"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStepWithOneInTheMiddle", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("parameter", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
        }
        public void InputGeneratorParametersAreCaseSensitive()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with 'cAsE sEnSiTiVe' parameter"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStepWithParameter", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("cAsE sEnSiTiVe", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
        }
        public void InputGeneratorCreatesOneStepWithOneParamaterAndTable()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with 'one' parameter and:",
                "\t\t| a | b | c |",
                "\t\t| 1 | 2 | 3 |"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("GivenIHaveAStepWithParameterAnd", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("one", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
            Assert.AreEqual(2, features[0].Scenarios[0].Steps[0].Rows.Count, "table row count mismatch");
        }
        public void InputGeneratorCreatesOneStepWithOneParamaterAndTable()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with 'one' parameter and:",
                "\t\t| a | b | c |",
                "\t\t| 1 | 2 | 3 |"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("GivenIHaveAStepWithParameterAnd", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("one", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
            Assert.AreEqual(2, features[0].Scenarios[0].Steps[0].Rows.Count, "table row count mismatch");
        }
        public void InputGeneratorCreatesOneStepWithOneParameterAndOneStepWithoutParameters()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with one 'parameter'",
                "\tThen I have two steps"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(2, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStepWithOne", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("parameter", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
            Assert.AreEqual("ThenIHaveTwoSteps", features[0].Scenarios[0].Steps[1].Name);
            Assert.AreEqual(0, features[0].Scenarios[0].Steps[1].Parameters.Count, "parameter count mismatch");
        }
        public void InputGeneratorCreatesOneStepWithOneParameterAndOneStepWithoutParameters()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with one 'parameter'",
                "\tThen I have two steps"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(2, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStepWithOne", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("parameter", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
            Assert.AreEqual("ThenIHaveTwoSteps", features[0].Scenarios[0].Steps[1].Name);
            Assert.AreEqual(0, features[0].Scenarios[0].Steps[1].Parameters.Count, "parameter count mismatch");
        }
        public void InputGeneratorCreatesOneStepWithTwoParameters()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with 'two' amazing 'parameters'"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStepWithAmazing", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(2, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("p0", features[0].Scenarios[0].Steps[0].Parameters[0].Name);
            Assert.AreEqual("p1", features[0].Scenarios[0].Steps[0].Parameters[1].Name);
            Assert.AreEqual("two", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
            Assert.AreEqual("parameters", features[0].Scenarios[0].Steps[0].Parameters[1].Value);
        }
        public void InputGeneratorExampleTableHandlesSpaces()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario Outline: my new scenario outline",
                "\tGiven I have a step",
                "",
                "Examples:",
                "\t| a bc | ab c | a b c |",
                "\t|  1   |  2   |  3    |"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(2, ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows.Count, "examples row count mismatch");
            Assert.AreEqual("abc", ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows[0][0]);
            Assert.AreEqual("abc", ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows[0][1]);
            Assert.AreEqual("abc", ((NodeScenarioOutline)features[0].Scenarios[0]).Examples.Rows[0][2]);
        }
        public void InputGeneratorCreatesOneStepWithTable()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step:",
                "\t\t| a | b | c |",
                "\t\t| 1 | 2 | 3 |"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("GivenIHaveAStep", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(2, features[0].Scenarios[0].Steps[0].Rows.Count, "table row count mismatch");
            Assert.AreEqual("a", features[0].Scenarios[0].Steps[0].Rows[0][0]);
            Assert.AreEqual("b", features[0].Scenarios[0].Steps[0].Rows[0][1]);
            Assert.AreEqual("c", features[0].Scenarios[0].Steps[0].Rows[0][2]);
            Assert.AreEqual("1", features[0].Scenarios[0].Steps[0].Rows[1][0]);
            Assert.AreEqual("2", features[0].Scenarios[0].Steps[0].Rows[1][1]);
            Assert.AreEqual("3", features[0].Scenarios[0].Steps[0].Rows[1][2]);
        }
        public void InputGeneratorHandlesDuplicateHooks()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "@f1",
                "@f1",
                "Feature: my new feature",
                "",
                "@f1",
                "@f1",
                "@s1",
                "@s1",
                "Scenario: my new scenario"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("f1", features[0].Hooks[0].Name);
            Assert.AreEqual(2, features[0].Scenarios[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("f1", features[0].Scenarios[0].Hooks[0].Name);
            Assert.AreEqual("s1", features[0].Scenarios[0].Hooks[1].Name);
        }
        public void InputGeneratorCreatesOneStepWithTable()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step:",
                "\t\t| a | b | c |",
                "\t\t| 1 | 2 | 3 |"
            };
            var features = generator.Load(contents);

            Assert.AreEqual("GivenIHaveAStep", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(2, features[0].Scenarios[0].Steps[0].Rows.Count, "table row count mismatch");
            Assert.AreEqual("a", features[0].Scenarios[0].Steps[0].Rows[0][0]);
            Assert.AreEqual("b", features[0].Scenarios[0].Steps[0].Rows[0][1]);
            Assert.AreEqual("c", features[0].Scenarios[0].Steps[0].Rows[0][2]);
            Assert.AreEqual("1", features[0].Scenarios[0].Steps[0].Rows[1][0]);
            Assert.AreEqual("2", features[0].Scenarios[0].Steps[0].Rows[1][1]);
            Assert.AreEqual("3", features[0].Scenarios[0].Steps[0].Rows[1][2]);
        }
        public void InputGeneratorParameterTypesAreCorrect()
        {
            InputGenerator generator = new InputGenerator();

            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with '1' int",
                "\tGiven I have a step with '1.1' decimal",
                "\tGiven I have a step with 'one1' string"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(3, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch on step 1");
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[1].Parameters.Count, "parameter count mismatch on step 2");
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[2].Parameters.Count, "parameter count mismatch on step 3");

            Assert.AreEqual("int", features[0].Scenarios[0].Steps[0].Parameters[0].Type);
            Assert.AreEqual("decimal", features[0].Scenarios[0].Steps[1].Parameters[0].Type);
            Assert.AreEqual("string", features[0].Scenarios[0].Steps[2].Parameters[0].Type);
        }
        public void InputGeneratorParameterTypesAreCorrect()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with '1' int",
                "\tGiven I have a step with '1.1' decimal",
                "\tGiven I have a step with 'one1' string"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(3, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch on step 1");
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[1].Parameters.Count, "parameter count mismatch on step 2");
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[2].Parameters.Count, "parameter count mismatch on step 3");

            Assert.AreEqual("int", features[0].Scenarios[0].Steps[0].Parameters[0].Type);
            Assert.AreEqual("decimal", features[0].Scenarios[0].Steps[1].Parameters[0].Type);
            Assert.AreEqual("string", features[0].Scenarios[0].Steps[2].Parameters[0].Type);
        }
        public void InputGeneratorHandlesLeadingNumbersInStepName()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven 123:Abc123_-~!@#$%^&*()[].,",
            };
            var features = generator.Load(contents);

            Assert.AreEqual("Given123Abc123", features[0].Scenarios[0].Steps[0].Name);
        }
        public void InputGeneratorHandlesDuplicateHooks()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "@f1",
                "@f1",
                "Feature: my new feature",
                "",
                "@f1",
                "@f1",
                "@s1",
                "@s1",
                "Scenario: my new scenario"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("f1", features[0].Hooks[0].Name);
            Assert.AreEqual(2, features[0].Scenarios[0].Hooks.Count, "feature hook count mismatch");
            Assert.AreEqual("f1", features[0].Scenarios[0].Hooks[0].Name);
            Assert.AreEqual("s1", features[0].Scenarios[0].Hooks[1].Name);
        }
        public void InputGeneratorCreatesSecondFeatureWithHook()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "@f1",
                "Feature: feature1",
                "",
                "@s1",
                "Scenario: scenario1",
                "",
                "@f2",
                "Feature: feature2",
                "",
                "@s2",
                "Scenario: scenario2",
            };
            var features = generator.Load(contents);

            Assert.AreEqual(2, features.Count, "feature count mismatch");

            VerifyFeature(features[0], "1");

            VerifyFeature(features[1], "2");
        }
        public void InputGeneratorParametersAreCaseSensitive()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with 'cAsE sEnSiTiVe' parameter"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStepWithParameter", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(1, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("cAsE sEnSiTiVe", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
        }
        public void InputGeneratorCreatesOneStepWithTwoParameters()
        {
            InputGenerator generator = new InputGenerator();
            string[] contents = new string[] {
                "Feature: my new feature",
                "",
                "Scenario: my new scenario",
                "\tGiven I have a step with 'two' amazing 'parameters'"
            };
            var features = generator.Load(contents);

            Assert.AreEqual(1, features[0].Scenarios[0].Steps.Count, "step count mismatch");
            Assert.AreEqual("GivenIHaveAStepWithAmazing", features[0].Scenarios[0].Steps[0].Name);
            Assert.AreEqual(2, features[0].Scenarios[0].Steps[0].Parameters.Count, "parameter count mismatch");
            Assert.AreEqual("p0", features[0].Scenarios[0].Steps[0].Parameters[0].Name);
            Assert.AreEqual("p1", features[0].Scenarios[0].Steps[0].Parameters[1].Name);
            Assert.AreEqual("two", features[0].Scenarios[0].Steps[0].Parameters[0].Value);
            Assert.AreEqual("parameters", features[0].Scenarios[0].Steps[0].Parameters[1].Value);
        }