public Report(XElement xml) { Title = xml.Descendants("ReportTitle").First().Value; Subtitle = xml.Descendants("ReportSubtitle").First().Value; var reportBasis = xml.Descendants("ReportBasis").FirstOrDefault(); if (reportBasis != null) { ReportBasis = reportBasis.Value; } NumRows = Convert.ToInt32(xml.Descendants("NumRows").First().Value); NumColumns = Convert.ToInt32(xml.Descendants("NumColumns").First().Value); NumColTitleRows = Convert.ToInt32(xml.Descendants("NumColTitleRows").First().Value); var columnDescriptions = new List <ReportColumnDescription>(); foreach (var columnDescriptionXML in xml.Descendants("ColDesc")) { columnDescriptions.Add(new ReportColumnDescription(columnDescriptionXML)); } ColumnDescriptions = columnDescriptions; var rows = new List <ReportRow>(); var reportData = xml.Descendants("ReportData").FirstOrDefault(); Rows = new ReportRows(reportData, ColumnDescriptions); }
public Report(XElement xml) { Title = xml.Descendants("ReportTitle").First().Value; Subtitle = xml.Descendants("ReportSubtitle").First().Value; var reportBasis = xml.Descendants("ReportBasis").FirstOrDefault(); if (reportBasis != null) ReportBasis = reportBasis.Value; NumRows = Convert.ToInt32(xml.Descendants("NumRows").First().Value); NumColumns = Convert.ToInt32(xml.Descendants("NumColumns").First().Value); NumColTitleRows = Convert.ToInt32(xml.Descendants("NumColTitleRows").First().Value); var columnDescriptions = new List<ReportColumnDescription>(); foreach (var columnDescriptionXML in xml.Descendants("ColDesc")) columnDescriptions.Add(new ReportColumnDescription(columnDescriptionXML)); ColumnDescriptions = columnDescriptions; var rows = new List<ReportRow>(); var reportData = xml.Descendants("ReportData").FirstOrDefault(); Rows = new ReportRows(reportData, ColumnDescriptions); }
public void Subtotal() { var rows = new ReportRows(RowsXML(), null); Assert.AreEqual(1, rows.Subtotal.Count()); Assert.AreEqual("SubtotalRow", rows.Subtotal.First().Type); }
public void Text() { var rows = new ReportRows(RowsXML(), null); Assert.AreEqual(1, rows.Text.Count()); Assert.AreEqual("TextRow", rows.Text.First().Type); }
public void Data() { var rows = new ReportRows(RowsXML(), null); Assert.AreEqual(1, rows.Data.Count()); Assert.AreEqual("DataRow", rows.Data.First().Type); }