public ScenarioOutlineExampleRowViewModel(ScenarioOutlineViewModel scenario, GherkinTableRow header, GherkinTableRow row)
        {
            DataRowNode = row;
            PlaceholderValues = header.Cells.Zip(row.Cells, Tuple.Create).ToDictionary(x => x.Item1.Value, x => x.Item2.Value);

            Steps = scenario.StepTemplates.Select(BuildStep).ToList();
        }
        private static void AddTableRow(GherkinTableRow row, bool isHeader, StringBuilder formettedScenario)
        {
            string elementName = isHeader ? "th" : "td";

            formettedScenario.AppendLine("<tr>");
            foreach (var cell in row.Cells)
            {
                formettedScenario.AppendFormat("<{0}>{1}</{0}>", elementName, string.IsNullOrWhiteSpace(cell.Value) ? "&nbsp;" : cell.Value);
            }
            formettedScenario.AppendLine("</tr>");
        }
Example #3
0
        public void ProcessTableRow(string[] cells, FilePosition rowPosition)
        {
            var row = new GherkinTableRow(cells.Select(c => new GherkinTableCell(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);
        }
Example #4
0
 private void CalculateWidth(int[] widths, GherkinTableRow row)
 {
     int i = 0;
     foreach (var cell in row.Cells)
     {
         widths[i] = Math.Max(widths[i], cell.Value.Length);
         i++;
     }
 }
Example #5
0
        protected virtual void AppendTableRow(StringBuilder result, GherkinTableRow row, string tableIndent, int[] widths)
        {
            result.Append(tableIndent);

            int i = 0;
            foreach (var cell in row.Cells)
            {
                result.Append("| ");
                result.Append(cell.Value);
                result.Append(new string(' ', widths[i] - cell.Value.Length));
                result.Append(" ");
                i++;
            }
            result.Append("|");
            AppendLine(result);
        }
Example #6
0
 public GherkinTable(GherkinTableRow header, params GherkinTableRow[] body)
 {
     Header = header;
     Body   = body;
 }
 private GherkinTableRow Clone(GherkinTableRow row)
 {
     return new GherkinTableRow(row.Cells.Select(c => new GherkinTableCell(){Value = c.Value}).ToArray());
 }
Example #8
0
 public GherkinTable(GherkinTableRow header, params GherkinTableRow[] body)
 {
     Header = header;
     Body = body;
 }