Пример #1
0
        private static ReportSpec MakeReportSpec()
        {
            var specList = new ReportSpecList();
            var defaults = specList.GetDefaults();

            return(defaults.First(spec => spec.Name == Resources.ReportSpecList_GetDefaults_Peak_Boundaries));
        }
Пример #2
0
        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);
                    }
                }
            }
        }
Пример #3
0
        public void TestUpgradedReportSpecList()
        {
            var toolList = new ToolList();
            toolList.AddDefaults();
            var cleanPersistedViews = new PersistedViews(null, null, toolList);
            for (int oldRevision = 0; oldRevision < 2; oldRevision++)
            {
                var oldReportSpecList = new ReportSpecList {RevisionIndex = oldRevision};
                oldReportSpecList.AddRange(oldReportSpecList.GetDefaults(oldRevision));
                var upgradedPersistedViews = new PersistedViews(oldReportSpecList, null, toolList);
                foreach (var group in new[] {PersistedViews.MainGroup, PersistedViews.ExternalToolsGroup})
                {
                    var cleanViews = cleanPersistedViews.GetViewSpecList(group.Id).ViewSpecs.ToArray();
                    var upgragedViews = upgradedPersistedViews.GetViewSpecList(group.Id).ViewSpecs.ToArray();

                    CollectionAssert.AreEquivalent(cleanViews, upgragedViews,
                        "Upgraded from rev {0} in group {1}", oldRevision, group);
                }
            }
        }
Пример #4
0
        public void TestUpgradedReportSpecList()
        {
            var toolList = new ToolList();

            toolList.AddDefaults();
            var cleanPersistedViews = new PersistedViews(null, null, toolList);

            for (int oldRevision = 0; oldRevision < 2; oldRevision++)
            {
                var oldReportSpecList = new ReportSpecList {
                    RevisionIndex = oldRevision
                };
                oldReportSpecList.AddRange(oldReportSpecList.GetDefaults(oldRevision));
                var upgradedPersistedViews = new PersistedViews(oldReportSpecList, null, toolList);
                foreach (var group in new[] { PersistedViews.MainGroup, PersistedViews.ExternalToolsGroup })
                {
                    var cleanViews    = cleanPersistedViews.GetViewSpecList(group.Id).ViewSpecs.ToArray();
                    var upgragedViews = upgradedPersistedViews.GetViewSpecList(group.Id).ViewSpecs.ToArray();

                    CollectionAssert.AreEquivalent(cleanViews, upgragedViews,
                                                   "Upgraded from rev {0} in group {1}", oldRevision, group);
                }
            }
        }
Пример #5
0
 private static ReportSpec MakeReportSpec()
 {
     var specList = new ReportSpecList();
     var defaults = specList.GetDefaults();
     return defaults.First(spec => spec.Name == Resources.ReportSpecList_GetDefaults_Peak_Boundaries);
 }
Пример #6
0
        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);
                    }
                }
            }
        }