private static ReportSpec GetDefaultReport(string name) { var reportSpecList = new ReportSpecList(); reportSpecList.AddDefaults(); return(reportSpecList.First(reportSpec => name == reportSpec.Name)); }
public void TestReportSpecListXml() { ReportSpecList reportSpecList = new ReportSpecList(); reportSpecList.AddDefaults(); Assert.AreNotEqual(0, reportSpecList.Count); StringBuilder stringBuilder = new StringBuilder(); using (XmlWriter xmlWriter = XmlWriter.Create(stringBuilder)) { Debug.Assert(xmlWriter != null); xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("testElement"); reportSpecList.WriteXml(xmlWriter); xmlWriter.WriteEndElement(); xmlWriter.WriteEndDocument(); } XmlReader xmlReader = XmlReader.Create(new StringReader(stringBuilder.ToString())); ReportSpecList compare = new ReportSpecList(); compare.ReadXml(xmlReader); Assert.AreEqual(reportSpecList.Count, compare.Count); for (int i = 0; i < reportSpecList.Count; i++) { ReportSpec reportSpec = reportSpecList[i]; ReportSpec reportSpecCompare = compare[i]; Assert.AreNotSame(reportSpec, reportSpecCompare); Assert.AreEqual(reportSpec, reportSpecCompare); Assert.AreEqual(reportSpec.GetHashCode(), reportSpecCompare.GetHashCode()); } }
private static ReportSpec GetDefaultReport(string name) { var reportSpecList = new ReportSpecList(); reportSpecList.AddDefaults(); return reportSpecList.First(reportSpec => name == reportSpec.Name); }