Example #1
0
        public void Build_WithCustomPropertyForComplexHeaderUsingAddHeaderProperty_CorrectProperties()
        {
            VerticalReportSchemaBuilder <string> reportBuilder = new VerticalReportSchemaBuilder <string>();

            reportBuilder.AddColumn("Value", s => s);
            reportBuilder.AddComplexHeader(0, "Complex", "Value");
            reportBuilder.AddComplexHeaderProperties("Complex", new CustomHeaderProperty());

            IReportTable <ReportCell> table = reportBuilder.BuildSchema().BuildReportTable(new string[] { });

            ReportCell[][] cells = this.GetCellsAsArray(table.HeaderRows);
            cells.Should().HaveCount(2);
            cells[0][0].Properties.Should()
            .HaveCount(1).And
            .ContainItemsAssignableTo <CustomHeaderProperty>();
        }
        public void Build_OneColumnTwoHeaderRows_CorrectCells()
        {
            VerticalReportSchemaBuilder <int> reportBuilder = new VerticalReportSchemaBuilder <int>();

            reportBuilder.AddColumn("Value", i => i);
            reportBuilder.AddComplexHeader(0, "Statistics", "Value");

            IReportTable <ReportCell> table = reportBuilder.BuildSchema().BuildReportTable(new[] { 1 });

            ReportCell[][] headerCells = this.GetCellsAsArray(table.HeaderRows);
            headerCells.Should().HaveCount(2);
            headerCells[0][0].GetValue <string>().Should().Be("Statistics");
            headerCells[1][0].GetValue <string>().Should().Be("Value");

            ReportCell[][] cells = this.GetCellsAsArray(table.Rows);
            cells.Should().HaveCount(1);
            cells[0][0].GetValue <int>().Should().Be(1);
        }