Exemplo n.º 1
0
        private IEnumerable <Completion> GetKeywordCompletions()
        {
            GherkinDialect dialect = GetDialect(languageService);

            return(dialect.GetStepKeywords().Select(k => new Completion(k.Trim(), k.Trim(), null, null, null)).Concat(
                       dialect.GetBlockKeywords().Select(k => new Completion(k.Trim(), k.Trim() + ": ", null, null, null))));
        }
        private GherkinBlockKeyword GetBlockKeyword(string line, GherkinDialect dialect)
        {
            var trimmedLine = line.TrimStart();

            return(Enum.GetValues(typeof(GherkinBlockKeyword))
                   .Cast <GherkinBlockKeyword>()
                   .First(keyword => dialect.GetBlockKeywords(keyword).Any(word => trimmedLine.StartsWith(word))));
        }
Exemplo n.º 3
0
 protected virtual void AppendScenarioLine(StringBuilder result, Scenario scenario, GherkinDialect dialect, bool isOutline)
 {
     AppendNodeLine(result, scenario.FilePosition, "{0}: {1}",
                    dialect.GetBlockKeywords(isOutline ? GherkinBlockKeyword.ScenarioOutline : GherkinBlockKeyword.Scenario).First(),
                    scenario.Title);
     if (!string.IsNullOrEmpty(scenario.Description))
     {
         AppendMulitLine(result, scenario.Description);
     }
 }
Exemplo n.º 4
0
        private void AddDefaultKeywordCompletions(GherkinDialect gherkinDialect, List <Completion> completions)
        {
            foreach (var keyword in gherkinDialect.StepKeywords)
            {
                completions.Add(new Completion(keyword));
            }

            foreach (var blockKeyword in gherkinDialect.GetBlockKeywords())
            {
                completions.Add(new Completion(blockKeyword + ": "));
            }
        }
        private bool IsBlockLine(string line, GherkinDialect dialect)
        {
            var trimmedLine = line.TrimStart();

            return(dialect.GetBlockKeywords().Any(keyword => trimmedLine.StartsWith(keyword)));
        }
Exemplo n.º 6
0
 protected virtual void AppendExampleSetLine(StringBuilder result, GherkinDialect dialect, ExampleSet exampleSet)
 {
     result.AppendFormat("{0}: {1}", dialect.GetBlockKeywords(GherkinBlockKeyword.Examples).First(), exampleSet.Title);
     AppendLine(result);
 }