public void TestColumnsFromResultsTables() { SrmDocument srmDocument = ResultsUtil.DeserializeDocument("silac_1_to_4.sky", GetType()); using (Database database = new Database()) { database.AddSrmDocument(srmDocument); SimpleReport report = new SimpleReport { Columns = new[] { new ReportColumn(typeof(DbTransitionResult), "PrecursorResult", "PeptideResult", "ProteinResult", "ReplicateName"), new ReportColumn(typeof(DbTransition), "Precursor", "Peptide", "Protein", "Name"), new ReportColumn(typeof(DbTransition), "Precursor", "Peptide", "Sequence"), new ReportColumn(typeof(DbTransitionResult), "Area"), }, }; ColumnSet columnSet = ColumnSet.GetTransitionsColumnSet(database.GetSchema()); TreeView treeView = new TreeView(); treeView.Nodes.AddRange(columnSet.GetTreeNodes().ToArray()); List <NodeData> columnInfos; columnSet.GetColumnInfos(report, treeView, out columnInfos); Assert.AreEqual(report.Columns.Count, columnInfos.Count); SimpleReport reportCompare = (SimpleReport)columnSet.GetReport(columnInfos, null); Assert.IsTrue(ArrayUtil.EqualsDeep(report.Columns, reportCompare.Columns)); } }
public void TestReportSpecList() { ReportSpecList reportSpecList = new ReportSpecList(); using (Database database = new Database()) { ColumnSet columnSet = ColumnSet.GetTransitionsColumnSet(database.GetSchema()); TreeView treeView = new TreeView(); treeView.Nodes.AddRange(columnSet.GetTreeNodes().ToArray()); foreach (ReportSpec reportSpec in reportSpecList.GetDefaults()) { Report report = Report.Load(reportSpec); ResultSet resultSet = report.Execute(database); List <NodeData> nodeDatas; columnSet.GetColumnInfos(report, treeView, out nodeDatas); Assert.IsFalse(nodeDatas.Contains(null)); if (reportSpec.GroupBy == null) { SimpleReport simpleReport = (SimpleReport)report; Assert.AreEqual(simpleReport.Columns.Count, resultSet.ColumnInfos.Count); Assert.AreEqual(simpleReport.Columns.Count, nodeDatas.Count); } } } }
public void SetDatabase(Database database) { _database = database; _columnSet = ColumnSet.GetTransitionsColumnSet(_database.GetSchema()); treeView.Nodes.Clear(); treeView.Nodes.AddRange(_columnSet.GetTreeNodes().ToArray()); }