private static void AppendTable(StringBuilder content, int cellCount, string[] headers = null) { var rows = new List <string[]>(); headers = headers ?? LoremIpsum.GetUniqueWords(cellCount); rows.Add(headers); for (int i = 0; i < 4; i++) { rows.Add(LoremIpsum.GetWords(cellCount)); } var cellWiths = Enumerable.Range(0, cellCount) .Select(i => rows.Max(r => r[i].Length)).ToArray(); foreach (var row in rows) { content.Append(" | "); for (int i = 0; i < cellCount; i++) { content.Append(row[i].PadRight(cellWiths[i])); content.Append(" | "); } content.AppendLine(); } }
private void GenerateScenarioOutline(StringBuilder content) { var headers = LoremIpsum.GetUniqueWords(3); content.AppendLine(LoremIpsum.GetShortText(LoremIpsum.Rnd.Next(3), "@")); content.AppendLine($"Scenario Outline: {ToTitle(LoremIpsum.GetShortText())}"); AddSteps(content, headers); content.AppendLine($"Examples: {ToTitle(LoremIpsum.GetShortText())}"); AppendTable(content, 3, headers); content.AppendLine(); }