public void AssertCsvString() { var percentageReport = new SubReport { Header = "Groffe", GroupedData = new[] {new GroupData {Description = "1", AllGroupsCount = 100, GroupCount = 1}} //KeyValuePair<double, string>(1, "1")} }; var e = new Report {ReportHeader = "Gryffe"}; e.Add(percentageReport); var expected = "Gryffe\t\t\t\t\t\r\n\tGroffe\t100\t\t\t\r\n\t\t\t1\t1\tINF"; //Infinity var actual = string.Join(ReportBuilder.CrLf, e.ToCsvReport().ToArray()); Assert.AreEqual(expected, actual); }
public void Add(SubReport subReport) { _percentageReports.Add(subReport); }
private static Report BuildMyReport(string header, IEnumerable<KeyValuePair<string, IEnumerable<Respondent>>> groupedRespondents, Func<IEnumerable<Respondent>, IEnumerable<GroupData>> grouper) { var report = new Report {ReportHeader = header}; foreach (var respondents in groupedRespondents) { var percentageReport = new SubReport { Header = respondents.Key, GroupedData = grouper(respondents.Value) }; report.Add(percentageReport); } return report; }