Inheritance: CucumberLanguageServices.Integration.StepProvider
        public void Should_create_no_textspans_for_defined_stepIdentifiers()
        {
            // Given
            var stepProvider = new StepProviderToTest(new StepDefinition("^[abcxyz]$"));
            var warningCreator = new WarningCreator { Root = _parseTree.Root, StepProvider = stepProvider, Grammar = _grammar, Source = null };

            // When
            warningCreator.CreateSpansForUndefinedSteps();

            // Then
            Assert.That(warningCreator.Result, Has.Count(0));
        }
        public void Should_create_textspans_for_undefined_stepIdentifiers()
        {
            // Given
            var stepProvider = new StepProviderToTest(new StepDefinition("^[xyz]$"));
            var warningCreator = new WarningCreator { Root = _parseTree.Root, StepProvider = stepProvider, Grammar = _grammar, Source = null };

            // When
            warningCreator.CreateSpansForUndefinedSteps();

            // Then
            Assert.That(warningCreator.Result, Has.Count(3));
            Assert.That(warningCreator.Result[0].iStartLine, Is.EqualTo(7));
            Assert.That(warningCreator.Result[1].iStartLine, Is.EqualTo(8));
            Assert.That(warningCreator.Result[2].iStartLine, Is.EqualTo(9));
        }
        public void Should_find_matching_step_definitions()
        {
            // Given
            var stepProvider = new StepProviderToTest
                                   (
                                        new StepDefinition("^nothing$"),
                                        new StepDefinition("^match\\d$"),
                                        new StepDefinition("^nomatch\\d$")
                                   );

            // When
            var matches = stepProvider.FindMatchesFor("match1");

            // Then
            Assert.That(matches, Has.Length(1));
            Assert.That(matches[0].Value, Is.EqualTo("^match\\d$"));
        }
        public void Should_split_stepIdentifier_when_step_has_arguments()
        {
            // Given
            var stepProvider = new StepProviderToTest(new StepDefinition("My phone number is (\\d+) and my name is '(.*)'"));
            var scanner = new LineScanner(new GherkinGrammar()) { StepProvider = stepProvider};

            // When
            var tokens = ReadTokens(scanner, "Given My phone number is 555 and my name is 'Henri'");

            // Then
            Assert.That(tokens, Has.Length(6));
            Assert.That(tokens[0].Type, Is.EqualTo(TokenType.Keyword), "Given");
            Assert.That(tokens[1].Type, Is.EqualTo(TokenType.Identifier), tokens[1].Token.ToString());
            Assert.That(tokens[2].Type, Is.EqualTo(TokenType.String), tokens[2].Token.ToString());
            Assert.That(tokens[3].Type, Is.EqualTo(TokenType.Identifier), tokens[3].Token.ToString());
            Assert.That(tokens[4].Type, Is.EqualTo(TokenType.String), tokens[4].Token.ToString());
            Assert.That(tokens[5].Type, Is.EqualTo(TokenType.Identifier), tokens[5].Token.ToString());
        }