Example #1
0
 public void AssertCsvHeaderString()
 {
     var e = new Report {ReportHeader = "Gryffe"};
     var expected = "Gryffe\t\t\t\t\t";
     var actual = string.Join(ReportBuilder.CrLf, e.ToCsvReport().ToArray());
     Assert.AreEqual(expected, actual);
 }
Example #2
0
 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);
 }
Example #3
0
 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;
 }