当前位置: 首页>>代码示例>>C#>>正文


C# Gherkin.GherkinBufferSpan类代码示例

本文整理汇总了C#中TechTalk.SpecFlow.Parser.Gherkin.GherkinBufferSpan的典型用法代码示例。如果您正苦于以下问题:C# GherkinBufferSpan类的具体用法?C# GherkinBufferSpan怎么用?C# GherkinBufferSpan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GherkinBufferSpan类属于TechTalk.SpecFlow.Parser.Gherkin命名空间,在下文中一共展示了GherkinBufferSpan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ColorizeLinePart

        private void ColorizeLinePart(string value, GherkinBufferSpan span, IClassificationType classificationType)
        {
            var textPosition = gherkinBuffer.IndexOfTextForLine(value, span.StartPosition.Line);
            if (textPosition == null)
                return;

            var textSpan = new GherkinBufferSpan(
                textPosition,
                textPosition.ShiftByCharacters(value.Length));
            ColorizeSpan(textSpan, classificationType);
        }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:11,代码来源:GherkinFileEditorParserListener.cs

示例2: Examples

        public void Examples(string keyword, string name, string description, GherkinBufferSpan headerSpan, GherkinBufferSpan descriptionSpan)
        {
            var position = GetFilePosition(headerSpan.StartPosition);
            var exampleBuilder = new ExampleBuilder(name, description, position);
            tableProcessor = exampleBuilder;

            if (exampleProcessor == null)
                throw new GherkinSemanticErrorException(
                    "Examples can only be specified for a scenario outline.", position);
            exampleProcessor.ProcessExample(exampleBuilder);
        }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:11,代码来源:GherkinParserListener.cs

示例3: ColorizeSpan

        private void ColorizeSpan(GherkinBufferSpan span, IClassificationType classificationType)
        {
            if (span == null)
                return;

            var startLine = textSnapshot.GetLineFromLineNumber(span.StartPosition.Line);
            var endLine = span.StartPosition.Line == span.EndPosition.Line ? startLine :
                textSnapshot.GetLineFromLineNumber(span.EndPosition.Line);
            var startIndex = startLine.Start + span.StartPosition.LinePosition;

            AddClassification(classificationType, 
                startIndex, 
                endLine.Start + span.EndPosition.LinePosition - startIndex);
        }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:14,代码来源:GherkinFileEditorParserListener.cs

示例4: ColorizeSpan

        private void ColorizeSpan(GherkinBufferSpan span, IClassificationType classificationType)
        {
            if (span == null)
                return;

            var startLine = textSnapshot.GetLineFromLineNumber(span.StartPosition.Line);
            var endLine = span.StartPosition.Line == span.EndPosition.Line ? 
                startLine : textSnapshot.GetLineFromLineNumber(span.EndPosition.Line);
            var startIndex = startLine.Start + span.StartPosition.LinePosition;
            var endLinePosition = span.EndPosition.LinePosition == endLine.Length ? 
                endLine.LengthIncludingLineBreak : span.EndPosition.LinePosition;
            var length = endLine.Start + endLinePosition - startIndex;
            AddClassification(classificationType, startIndex, length);
        }
开发者ID:matgiro,项目名称:SpecFlow,代码行数:14,代码来源:GherkinTextBufferParserListener.cs

示例5: Comment

        public void Comment(string commentText, GherkinBufferSpan commentSpan)
        {
            if (GherkinDialectServices.IsLanguageLine(commentText))
                return;

            var position = GetFilePosition(commentSpan.StartPosition);
            string trimmedComment = commentText.TrimStart(' ', '#', '\t');
            position.Column += commentText.Length - trimmedComment.Length;
            trimmedComment = trimmedComment.Trim();

            if (trimmedComment.Length == 0)
                return;

            featureBuilder.AddComment(trimmedComment, position);
        }
开发者ID:Galad,项目名称:SpecFlow,代码行数:15,代码来源:GherkinParserListener.cs

示例6: Examples

 public void Examples(string keyword, string name, string description, GherkinBufferSpan headerSpan, GherkinBufferSpan descriptionSpan)
 {
     //TODO: outline
     RegisterKeyword(keyword, headerSpan);
     ColorizeSpan(descriptionSpan, classifications.Description);
 }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:6,代码来源:GherkinFileEditorParserListener.cs

示例7: ScenarioOutline

 public void ScenarioOutline(string keyword, string name, string description, GherkinBufferSpan headerSpan, GherkinBufferSpan descriptionSpan)
 {
     ScenarioEditorInfo scenario = ProcessScenario(keyword, name, headerSpan, descriptionSpan);
     scenario.IsScenarioOutline = true;
 }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:5,代码来源:GherkinFileEditorParserListener.cs

示例8: Comment

 public void Comment(string commentText, GherkinBufferSpan commentSpan)
 {
     ColorizeSpan(commentSpan, classifications.Comment);
 }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:4,代码来源:GherkinFileEditorParserListener.cs

示例9: Feature

 public void Feature(string keyword, string name, string description, GherkinBufferSpan headerSpan, GherkinBufferSpan descriptionSpan)
 {
     ColorizeKeywordLine(keyword, headerSpan, classifications.FeatureTitle);
     ColorizeSpan(descriptionSpan, classifications.Description);
 }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:5,代码来源:GherkinFileEditorParserListener.cs

示例10: ScenarioOutline

 public void ScenarioOutline(string keyword, string name, string description, GherkinBufferSpan headerSpan, GherkinBufferSpan descriptionSpan)
 {
     ProcessScenario(keyword, name, headerSpan, descriptionSpan, typeof(IScenarioOutlineBlock));
 }
开发者ID:matgiro,项目名称:SpecFlow,代码行数:4,代码来源:GherkinTextBufferParserListener.cs

示例11: Feature

        public virtual void Feature(string keyword, string name, string description, GherkinBufferSpan headerSpan, GherkinBufferSpan descriptionSpan)
        {
            CurrentFileBlockBuilder.SetMainData(typeof(IHeaderBlock), headerSpan.StartPosition.Line, keyword, name);

            ColorizeKeywordLine(keyword, headerSpan, classifications.FeatureTitle);
            ColorizeSpan(descriptionSpan, classifications.Description);
        }
开发者ID:matgiro,项目名称:SpecFlow,代码行数:7,代码来源:GherkinTextBufferParserListener.cs

示例12: MultilineText

        public void MultilineText(string text, GherkinBufferSpan textSpan)
        {
            ColorizeSpan(textSpan, classifications.MultilineText);

            if (currentStep != null)
            {
                currentStep.MultilineTextArgument = text;
            }
            else
            {
                //TODO: shall we mark it as error?
            }
        }
开发者ID:matgiro,项目名称:SpecFlow,代码行数:13,代码来源:GherkinTextBufferParserListener.cs

示例13: ScenarioTag

 public void ScenarioTag(string name, GherkinBufferSpan tagSpan)
 {
     EnsureNewScenario(tagSpan.StartPosition.Line);
     ColorizeSpan(tagSpan, classifications.Tag);
 }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:5,代码来源:GherkinFileEditorParserListener.cs

示例14: Step

        public void Step(string keyword, StepKeyword stepKeyword, Parser.Gherkin.ScenarioBlock scenarioBlock, string text, GherkinBufferSpan stepSpan)
        {
            if (CurrentFileBlockBuilder.BlockType == typeof(IScenarioOutlineBlock))
            {
                var matches = placeholderRe.Matches(text);
                foreach (Match match in matches)
                    ColorizeLinePart(match.Value, stepSpan, classifications.Placeholder);
            }

            var editorLine = stepSpan.StartPosition.Line;
            var tags = FeatureTags.Concat(CurrentFileBlockBuilder.Tags).Distinct();
            var stepContext = new StepContext(FeatureTitle, CurrentFileBlockBuilder.BlockType == typeof(IBackgroundBlock) ? null : CurrentFileBlockBuilder.Title, tags.ToArray(), gherkinFileScope.GherkinDialect.CultureInfo);

            currentStep = new GherkinStep((StepDefinitionType)scenarioBlock, (StepDefinitionKeyword)stepKeyword, text, stepContext, keyword, editorLine - CurrentFileBlockBuilder.KeywordLine);
            CurrentFileBlockBuilder.Steps.Add(currentStep);



            var bindingMatchService = projectScope.BindingMatchService;
         


            if (bindingMatchService.Ready && bindingMatchService != null)
            {
                List<BindingMatch> candidatingMatches;
                candidatingMatches = null;
                StepDefinitionAmbiguityReason ambiguityReason;
                CultureInfo bindingCulture = currentStep.StepContext.Language;
                var match = bindingMatchService.GetBestMatch(currentStep, bindingCulture, out ambiguityReason, out candidatingMatches);

                if (candidatingMatches.Count == 0)
                {
                    ColorizeKeywordLine(keyword, stepSpan, classifications.StepText);
                }
                else
                {
                    ColorizeKeywordLine(keyword, stepSpan, classifications.KnownStepText);
                    foreach (String value in candidatingMatches.First().StepBinding.Regex.Split(text))
                        ColorizeLinePart(value, stepSpan, classifications.Variable);
                }
                  

            
            }
            else
                ColorizeKeywordLine(keyword, stepSpan, classifications.StepText);

        }
开发者ID:matgiro,项目名称:SpecFlow,代码行数:48,代码来源:GherkinTextBufferParserListener.cs

示例15: TableRow

 public void TableRow(string[] cells, GherkinBufferSpan rowSpan, GherkinBufferSpan[] cellSpans)
 {
     foreach (var cellSpan in cellSpans)
     {
         ColorizeSpan(cellSpan, classifications.TableCell);
     }
     if (currentStep != null)
     {
         try
         {
             currentStep.TableArgument.AddRow(cells);
         }
         catch (Exception)
         {
             //TODO: shall we mark it as error?
         }
     }
     //TODO: register outline example
 }
开发者ID:matgiro,项目名称:SpecFlow,代码行数:19,代码来源:GherkinTextBufferParserListener.cs


注:本文中的TechTalk.SpecFlow.Parser.Gherkin.GherkinBufferSpan类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。