Exemplo n.º 1
0
        public void TextTable_NoHeaders()
        {
            TextTable table;

            table = new TextTable();
            Assert.AreEqual("", table.ToString());

            table = new TextTable();
            table.AppendRow(1);
            Assert.AreEqual("1\r\n", table.ToString());

            table = new TextTable();
            table.AppendRow(1, 2);
            Assert.AreEqual("1 2\r\n", table.ToString());

            table = new TextTable();
            table.AppendRow(1, 2, 3);
            Assert.AreEqual("1 2 3\r\n", table.ToString());

            table = new TextTable();
            table.AppendRow(100);
            table.AppendRow(200, 201);
            table.AppendRow(300, 301, 302);
            Assert.AreEqual("100\r\n200 201\r\n300 301 302\r\n", table.ToString());

            table = new TextTable();
            table.AppendRow("a");
            table.AppendRow(200, 201);
            table.AppendRow(300, 301, 302);
            Assert.AreEqual("a  \r\n200 201\r\n300 301 302\r\n", table.ToString());
        }
Exemplo n.º 2
0
        public void TextTable_Nulls()
        {
            TextTable table;

            table = new TextTable();
            table.SetHeaders("ID", "Name", "Text");

            table.AppendRow("1", "Jeff Lill", "AA");
            table.AppendRow(null, "Joe Bloe", "BBB");
            table.AppendRow("300", "Jane Doe", "");

            string results = "ID  Name      Text\r\n--- --------- ----\r\n1   Jeff Lill AA  \r\n    Joe Bloe  BBB \r\n300 Jane Doe      \r\n";

            Assert.AreEqual(results, table.ToString());
        }