示例#1
0
        public StepBuilder(string keyword, StepKeyword stepKeyword, string text, FilePosition position)
        {
            switch (stepKeyword)
            {
                case StepKeyword.Given:
                    step = new Given();
                    break;
                case StepKeyword.When:
                    step = new When();
                    break;
                case StepKeyword.Then:
                    step = new Then();
                    break;
                case StepKeyword.And:
                    step = new And();
                    break;
                case StepKeyword.But:
                    step = new But();
                    break;
                default:
                    throw new NotSupportedException();
            }

            step.Keyword = keyword;
            step.Text = text;
            step.FilePosition = position;
        }
示例#2
0
 public ScenarioBuilder(string name, string description, Tags tags, FilePosition position)
 {
     this.title = name;
     this.description = description;
     this.position = position;
     this.tags = tags;
 }
示例#3
0
 public BackgroundBuilder(string keyword, string name, string description, FilePosition position)
 {
     this.keyword = keyword;
     this.name = name;
     this.description = description;
     this.position = position;
 }
示例#4
0
 public void SetHeader(string keyword, string title, string description, Tags tags, FilePosition position)
 {
     this.keyword = keyword;
     this.title = title;
     this.description = description;
     this.tags = tags;
     this.position = position;
 }
示例#5
0
 public ExampleBuilder(string keyword, string name, string description, Tags tags, FilePosition position)
 {
     this.keyword = keyword;
     this.name = name;
     this.description = description;
     this.tags = tags;
     this.position = position;
 }
示例#6
0
        public StepBuilder(string keyword, string text, FilePosition position, I18n i18n)
        {
            if (i18n.keywords("given").contains(keyword)) step = new Given();
            else if (i18n.keywords("when").contains(keyword)) step = new When();
            else if (i18n.keywords("then").contains(keyword)) step = new Then();
            else if (i18n.keywords("and").contains(keyword)) step = new And();
            else if (i18n.keywords("but").contains(keyword)) step = new But();
            else throw new ArgumentOutOfRangeException(string.Format("Parameter 'keyword' has value that can not be translated! Value:'{0}'", keyword));

            step.Text = text;
            step.FilePosition = position;
        }
示例#7
0
        public void ProcessTableRow(string[] cells, FilePosition rowPosition)
        {
            var row = new Row(cells.Select(c => new Cell(c)).ToArray());
            row.FilePosition = rowPosition;

            if (tableRows.Count > 0 && tableRows[0].Cells.Length != row.Cells.Length)
            {
                throw new GherkinSemanticErrorException(
                    "Number of cells in the row does not match the number of cells in the header.", row.FilePosition);
            }

            tableRows.Add(row);
        }
 public ScenarioOutlineBuilder(string name, string description, Tags tags, FilePosition position)
 {
     this.title = TextHelper.GetText(name, description);
     this.tags = tags;
     this.position = position;
 }
示例#9
0
 public void ProcessTableRow(string[] row, FilePosition rowPosition)
 {
     tableBuilder.ProcessTableRow(row, rowPosition);
 }
示例#10
0
 public ExampleBuilder(string name, string description, FilePosition position)
 {
     this.text = TextHelper.GetText(name, description);
     this.position = position;
 }
示例#11
0
 private void AssertTableProcessor(FilePosition position)
 {
     if (tableProcessor == null)
         throw new GherkinSemanticErrorException(
             "Table argument can only be specified for steps and examples.", position);
 }
示例#12
0
 public void AddComment(string commentText, FilePosition filePosition)
 {
     comments.Add(new Comment(commentText, filePosition));
 }
示例#13
0
 public BackgroundBuilder(string text, FilePosition position)
 {
     this.text = text;
     this.position = position;
 }
示例#14
0
 public ScenarioOutlineBuilder(string keyword, string name, string description, Tags tags, FilePosition position) :
     base(keyword, name, description, tags, position)
 {
 }
示例#15
0
        public ScenarioStep CreateStep(string keyword, StepKeyword stepKeyword, string text, FilePosition position, ScenarioBlock scenarioBlock)
        {
            ScenarioStep step;
            switch (stepKeyword)
            {
                case StepKeyword.Given:
                    step = new Given();
                    break;
                case StepKeyword.When:
                    step = new When();
                    break;
                case StepKeyword.Then:
                    step = new Then();
                    break;
                case StepKeyword.And:
                    step = new And();
                    break;
                case StepKeyword.But:
                    step = new But();
                    break;
                default:
                    throw new NotSupportedException();
            }

            step.Keyword = keyword;
            step.Text = text;
            step.FilePosition = position;
            step.ScenarioBlock = scenarioBlock;
            step.StepKeyword = stepKeyword;
            return step;
        }
示例#16
0
 public ScenarioBuilder(string name, Tags tags, FilePosition position)
 {
     this.name = name;
     this.position = position;
     this.tags = tags;
 }
 public GherkinSemanticErrorException(string message, FilePosition position)
     : base(message, position.Line - 1, position.Column - 1)
 {
 }
示例#18
0
 public void ProcessTableRow(string[] cells, FilePosition rowPosition)
 {
     tableBuilder.ProcessTableRow(cells, rowPosition);
 }
示例#19
0
 public ExampleBuilder(string name, string description, FilePosition position)
 {
     this.name = name;
     this.description = description;
     this.position = position;
 }
示例#20
0
 protected virtual void AppendNodeLine(StringBuilder result, FilePosition filePosition, string textFormat, params object[] args)
 {
     result.AppendFormat(textFormat, args);
     AppendLine(result);
 }
示例#21
0
 public ExampleBuilder(string text, FilePosition position)
 {
     this.text = text;
     this.position = position;
 }