private void AddExamples(ReportModel.Scenario[] scenarioGroup) { var firstScenario = scenarioGroup.First(); var scenarioResult = (Result)scenarioGroup.Max(s => (int)s.Result); using (OpenTag("<li class='step'>", HtmlTag.li)) { AddLine("<span class='example-header'>Examples:</span>"); using (OpenTag(string.Format("<table class='examples' style='border-collapse: collapse;margin-left:10px''>"), HtmlTag.table)) { using (OpenTag("<tr>", HtmlTag.tr)) { AddLine(string.Format("<th></th>")); foreach (var header in firstScenario.Example.Headers) AddLine(string.Format("<th>{0}</th>", header)); if (scenarioResult == Result.Failed) AddLine(string.Format("<th>Error</th>")); } foreach (var scenario in scenarioGroup) AddExampleRow(scenario, scenarioResult); } } }
private void AddScenarioWithExamples(ReportModel.Scenario[] scenarioGroup) { var firstScenario = scenarioGroup.First(); var scenarioResult = (Result)scenarioGroup.Max(s => (int)s.Result); AddLine(string.Format("<div class='{0} canToggle scenarioTitle' data-toggle-target='{1}'>{2}{3}</div>", scenarioResult, firstScenario.Id, HttpUtility.HtmlEncode(firstScenario.Title), FormatTags(firstScenario.Tags))); using (OpenTag(string.Format("<ul class='steps' id='{0}'>", firstScenario.Id), HtmlTag.ul)) { foreach (var step in firstScenario.Steps.Where(s => s.ShouldReport)) { using (OpenTag(string.Format("<li class='step {0}'>", step.ExecutionOrder), HtmlTag.li)) { var titleLines = HttpUtility.HtmlEncode(step.Title) .Split(new[] { Environment.NewLine }, StringSplitOptions.None); var title = titleLines[0]; AddLine(string.Format("<span>{0}</span>", title)); for (int i = 1; i < titleLines.Length; i++) AddLine(string.Format("<div class='step-title-extra-lines'>{0}</div>", titleLines[i])); } } AddExamples(scenarioGroup); } }