public void TestColumnLevelPromotions_1() { InstanceReport thisReport = new InstanceReport(); InstanceReportColumn irc = new InstanceReportColumn(); //[1], [1], [1], [1], [1] --> nothing is promoted to column, should already be promoted to ROW irc.Id = 0; thisReport.Columns.Add(irc); for (int index = 0; index <= 4; index++) { InstanceReportRow irr = new InstanceReportRow(); irr.Id = index; Cell c = new Cell(0); irr.Cells.Add(c); thisReport.Rows.Add(irr); } (thisReport.Rows[0].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[0].Cells[0] as Cell).FootnoteIndexer = "[1]"; (thisReport.Rows[1].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[1].Cells[0] as Cell).FootnoteIndexer = "[1]"; (thisReport.Rows[2].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[2].Cells[0] as Cell).FootnoteIndexer = "[1]"; (thisReport.Rows[3].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[3].Cells[0] as Cell).FootnoteIndexer = "[1]"; (thisReport.Rows[4].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[4].Cells[0] as Cell).FootnoteIndexer = "[1]"; thisReport.PromoteFootnotes(); Console.WriteLine("Column level index = " + irc.FootnoteIndexer); foreach (InstanceReportRow irr in thisReport.Rows) { Cell c = irr.Cells[0] as Cell; Console.WriteLine(c.Id + " Cell level index = " + c.FootnoteIndexer); } Assert.IsTrue(irc.FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[0].Cells[0] as Cell).FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[1].Cells[0] as Cell).FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[2].Cells[0] as Cell).FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[3].Cells[0] as Cell).FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[4].Cells[0] as Cell).FootnoteIndexer == ""); }
public void TestRowLevelPromotions_1() { InstanceReport thisReport = new InstanceReport(); //[1], [1], [1], [1], NULL --> [1] promoted InstanceReportRow thisRow = new InstanceReportRow(); thisRow.Label = "Row 1"; thisRow.Id = 1; for (int index = 0; index <= 3; index++) { Cell c = new Cell(index); c.IsNumeric = true; c.NumericAmount = 100; c.FootnoteIndexer = "[1]"; thisRow.Cells.Add(c); } Cell c4 = new Cell(4); c4.IsNumeric = false; thisRow.Cells.Add(c4); thisReport.Rows.Add(thisRow); thisReport.PromoteFootnotes(); Console.WriteLine ("Row level index = " + thisRow.FootnoteIndexer); foreach (Cell c in thisRow.Cells) { Console.WriteLine(c.Id + " Cell level index = " + c.FootnoteIndexer); } Assert.IsTrue(thisRow.FootnoteIndexer == "[1]"); for (int index = 0; index <= 3; index++) { Cell c1 = thisRow.Cells[index] as Cell; Assert.IsTrue(String.IsNullOrEmpty(c1.FootnoteIndexer)); } }
public void TestRowLevelPromotions_4() { InstanceReport thisReport = new InstanceReport(); //[1] [2] [1],[2] NULL [3],[4] --> NOTHING promoted InstanceReportRow thisRow = new InstanceReportRow(); thisRow.Label = "Row 1"; thisRow.Id = 1; Cell c0 = new Cell(0); c0.IsNumeric = true; c0.FootnoteIndexer = "[1]"; thisRow.Cells.Add(c0); Cell c1 = new Cell(1); c1.IsNumeric = true; c1.FootnoteIndexer = "[2]"; thisRow.Cells.Add(c1); Cell c2 = new Cell(2); c2.IsNumeric = true; c2.FootnoteIndexer = "[1],[2]"; thisRow.Cells.Add(c2); Cell c3 = new Cell(3); c3.IsNumeric = false; thisRow.Cells.Add(c3); Cell c4 = new Cell(4); c4.IsNumeric = true; c4.FootnoteIndexer = "[3],[4]"; thisRow.Cells.Add(c4); thisReport.Rows.Add(thisRow); thisReport.PromoteFootnotes(); Console.WriteLine("Row level index = " + thisRow.FootnoteIndexer); foreach (Cell c in thisRow.Cells) { Console.WriteLine(c.Id + " Cell level index = " + c.FootnoteIndexer); } Assert.IsTrue(thisRow.FootnoteIndexer == ""); Assert.IsTrue((thisRow.Cells[0] as Cell).FootnoteIndexer == "[1]"); Assert.IsTrue((thisRow.Cells[1] as Cell).FootnoteIndexer == "[2]"); Assert.IsTrue((thisRow.Cells[2] as Cell).FootnoteIndexer == "[1],[2]"); Assert.IsTrue((thisRow.Cells[3] as Cell).FootnoteIndexer == ""); Assert.IsTrue((thisRow.Cells[4] as Cell).FootnoteIndexer == "[3],[4]"); }
public void TestColumnLevelPromotions_3() { InstanceReport thisReport = new InstanceReport(); InstanceReportColumn irc1 = new InstanceReportColumn(); InstanceReportColumn irc2 = new InstanceReportColumn(); //c0: [1],[2] [1],[2] [1],[2] [1],[2],[3] [1],[2] --> [1],[2] //c1: [4], [5], [6], [7], [8] --> NULL irc1.Id = 1; thisReport.Columns.Add(irc1); irc2.Id = 2; thisReport.Columns.Add(irc2); for (int index = 0; index <= 4; index++) { InstanceReportRow irr = new InstanceReportRow(); irr.Id = index + 1; Cell c1 = new Cell(1); irr.Cells.Add(c1); Cell c2 = new Cell(2); irr.Cells.Add(c2); thisReport.Rows.Add(irr); } (thisReport.Rows[0].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[0].Cells[0] as Cell).FootnoteIndexer = "[1],[2]"; (thisReport.Rows[1].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[1].Cells[0] as Cell).FootnoteIndexer = "[1],[2]"; (thisReport.Rows[2].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[2].Cells[0] as Cell).FootnoteIndexer = "[1],[2]"; (thisReport.Rows[3].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[3].Cells[0] as Cell).FootnoteIndexer = "[1],[2],[3]"; (thisReport.Rows[4].Cells[0] as Cell).IsNumeric = true; (thisReport.Rows[4].Cells[0] as Cell).FootnoteIndexer = "[1],[2]"; (thisReport.Rows[0].Cells[1] as Cell).IsNumeric = true; (thisReport.Rows[0].Cells[1] as Cell).FootnoteIndexer = "[4]"; (thisReport.Rows[1].Cells[1] as Cell).IsNumeric = true; (thisReport.Rows[1].Cells[1] as Cell).FootnoteIndexer = "[5]"; (thisReport.Rows[2].Cells[1] as Cell).IsNumeric = true; (thisReport.Rows[2].Cells[1] as Cell).FootnoteIndexer = "[6]"; (thisReport.Rows[3].Cells[1] as Cell).IsNumeric = true; (thisReport.Rows[3].Cells[1] as Cell).FootnoteIndexer = "[7]"; (thisReport.Rows[4].Cells[1] as Cell).IsNumeric = true; (thisReport.Rows[4].Cells[1] as Cell).FootnoteIndexer = "[8]"; thisReport.PromoteFootnotes(); Console.WriteLine("Column 1 level index = " + irc1.FootnoteIndexer); Console.WriteLine("Column 2 level index = " + irc2.FootnoteIndexer); foreach (InstanceReportRow irr in thisReport.Rows) { Cell c1 = irr.Cells[0] as Cell; Console.WriteLine(c1.Id + " Cell level index = " + c1.FootnoteIndexer); Cell c2 = irr.Cells[1] as Cell; Console.WriteLine(c2.Id + " Cell level index = " + c2.FootnoteIndexer); } Assert.IsTrue(irc1.FootnoteIndexer == "[1],[2]"); Assert.IsTrue(irc2.FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[0].Cells[0] as Cell).FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[1].Cells[0] as Cell).FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[2].Cells[0] as Cell).FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[3].Cells[0] as Cell).FootnoteIndexer == "[3]"); Assert.IsTrue((thisReport.Rows[4].Cells[0] as Cell).FootnoteIndexer == ""); Assert.IsTrue((thisReport.Rows[0].Cells[1] as Cell).FootnoteIndexer == "[4]"); Assert.IsTrue((thisReport.Rows[1].Cells[1] as Cell).FootnoteIndexer == "[5]"); Assert.IsTrue((thisReport.Rows[2].Cells[1] as Cell).FootnoteIndexer == "[6]"); Assert.IsTrue((thisReport.Rows[3].Cells[1] as Cell).FootnoteIndexer == "[7]"); Assert.IsTrue((thisReport.Rows[4].Cells[1] as Cell).FootnoteIndexer == "[8]"); }