Example #1
0
        public void Build_ColumnWithName_CorrectDisplay()
        {
            // Design Dummy Column
            DataColumn col = new DataColumn("DummyColumn");

            col.ExtendedProperties.Add("NBi::Role", ColumnRole.Key);
            col.ExtendedProperties.Add("NBi::Type", ColumnType.Text);
            col.ColumnName = "My very long name that I want to display!";

            // Design dummy table
            DataTable table = new DataTable();

            table.Columns.Add(col);

            var row = table.NewRow();

            row[0] = "My Value";
            row.SetColumnError(0, "(null)");

            ICellFormatter cf = LineFormatter.BuildHeader(table, 0);

            var length = cf.GetCellLength();
            var name   = cf.GetColumnName(length);

            Assert.That(name, Is.EqualTo("My very long name that I want to display! "));

            // This should be the returned value
            var text = cf.GetText(length);

            Assert.That(text, Is.StringStarting("KEY (Text) "));
        }
Example #2
0
        public void GetText_DateTimeTolerance_CorrectHeader()
        {
            // Design Dummy Column
            DataColumn col = new DataColumn("DummyColumn");

            col.ExtendedProperties.Add("NBi::Role", ColumnRole.Value);
            col.ExtendedProperties.Add("NBi::Type", ColumnType.Numeric);
            col.ExtendedProperties.Add("NBi::Tolerance", new DateTimeTolerance(new TimeSpan(0, 15, 0)));

            // Design dummy table
            DataTable table = new DataTable();

            table.Columns.Add(col);

            ICellFormatter cf = LineFormatter.BuildHeader(table, 0);

            // This must not throw an exception when the header is bigger that requested size
            var text = cf.GetText(cf.GetCellLength());

            Assert.That(text, Is.StringContaining("VALUE"));
            Assert.That(text, Is.StringContaining("Numeric"));
            Assert.That(text, Is.StringContaining("(+/- 00:15:00)"));
        }
Example #3
0
        public void GetText_NumericRounding_CorrectHeader()
        {
            // Design Dummy Column
            DataColumn col = new DataColumn("DummyColumn");

            col.ExtendedProperties.Add("NBi::Role", ColumnRole.Value);
            col.ExtendedProperties.Add("NBi::Type", ColumnType.Numeric);
            col.ExtendedProperties.Add("NBi::Rounding", new NumericRounding(10.5, Rounding.RoundingStyle.Round));

            // Design dummy table
            DataTable table = new DataTable();

            table.Columns.Add(col);

            ICellFormatter cf = LineFormatter.BuildHeader(table, 0);

            // This must not throw an exception when the header is bigger that requested size
            var text = cf.GetText(cf.GetCellLength());

            Assert.That(text, Is.StringContaining("VALUE"));
            Assert.That(text, Is.StringContaining("Numeric"));
            Assert.That(text, Is.StringContaining("(round 10.5)"));
        }