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) ? " " : cell.Value); } formettedScenario.AppendLine("</tr>"); }
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); }
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++; } }
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); }
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()); }
public GherkinTable(GherkinTableRow header, params GherkinTableRow[] body) { Header = header; Body = body; }