public string Process(CsvData data, TemplatesProvider provider) { var table = new HtmlTableBuilder(); var tableHtml = table.Build(data, provider); var formatted = string.Format(provider.HtmlPageTemplate, tableHtml); return formatted; }
public string Build(Dictionary<string, object> summary, string methodName, TemplatesProvider provider) { var allResultsTableTemplate = provider.SummaryTableTemplate; var sb = new StringBuilder(); var i = 0; foreach (var row in summary) { var rowClass = i % 2 == 0 ? "evenRow" : "oddRow"; sb.AppendLine($"<tr class=\"{rowClass}\"><td>{row.Key}</td><td>{row.Value}</td></tr>"); i++; } return string.Format(allResultsTableTemplate, methodName, sb); }
public string Build(CsvData data, TemplatesProvider provider) { var allResultsTableTemplate = provider.AllResultsTableTemplate; var sb = new StringBuilder(); var i = 0; foreach (var row in data.Rows) { var rowClass = i % 2 == 0 ? "evenRow" : "oddRow"; sb.AppendLine($"<tr class=\"{rowClass}\">"); foreach (var s in row.PlainData) { sb.Append($"<td>{s}</td>"); } sb.AppendLine("</tr>"); i++; } return string.Format(allResultsTableTemplate, sb); }
public string Process(CsvData data, TemplatesProvider provider) { var jDatas = from row in data.Rows group row by row.PlainData[2] into grouped select new JMeterData(grouped.ToList(), grouped.Key.Trim()); var sb = new StringBuilder(); foreach (var methodData in jDatas) { var summaryTable = new HtmlSummaryBuilder().Build(methodData.Summary, methodData.MethodName, provider); sb.Append(summaryTable); } var allResultstable = new HtmlTableBuilder().Build(data, provider); var formatted = string.Format(provider.HtmlPageTemplate, sb.ToString(), allResultstable); return formatted; }
public CsvProcessor(Config configuration) { _config = configuration; _templatesProvider = new TemplatesProvider(_config); }