public void FormatTest()
        {
            MyColumn column = new MyColumn();

            column.DataNavigateUrlFormatString = "!{0}!";
            Assert.AreEqual(String.Empty, column.FormatUrl(null), "#1");
            Assert.AreEqual("!foo!", column.FormatUrl("foo"), "#2");

            column.DataTextFormatString = "!{0}!";
            Assert.AreEqual(String.Empty, column.FormatText(null), "#3");
            Assert.AreEqual("!foo!", column.FormatText("foo"), "#4");
        }
        public void InitCellTest()
        {
            MyColumn  column;
            TableCell cell;

            /* test that for Header it just sets the cell.Text to HeaderText */
            column            = new MyColumn();
            cell              = new TableCell();
            column.HeaderText = "This is a Header";
            column.InitCell(cell, 0, ListItemType.Header);

            Assert.AreEqual("This is a Header", cell.Text, "#1");

            /* test that for Item it adds a HyperLinkControl */
            column             = new MyColumn();
            cell               = new TableCell();
            column.NavigateUrl = "http://www.novell.com/";
            column.Text        = "Novell.com";
            column.InitCell(cell, 0, ListItemType.Item);

            Assert.AreEqual(1, cell.Controls.Count, "#2");
            Assert.IsTrue(cell.Controls[0] is HyperLink, "#3");

            /* test that for EditItem it adds a HyperLinkControl */
            column             = new MyColumn();
            cell               = new TableCell();
            column.NavigateUrl = "http://www.novell.com/";
            column.Text        = "Novell.com";
            column.InitCell(cell, 0, ListItemType.EditItem);

            Assert.AreEqual(1, cell.Controls.Count, "#4");
            Assert.IsTrue(cell.Controls[0] is HyperLink, "#5");

            /* test that for AlternatingItem it adds a HyperLinkControl */
            column             = new MyColumn();
            cell               = new TableCell();
            column.NavigateUrl = "http://www.novell.com/";
            column.Text        = "Novell.com";
            column.InitCell(cell, 0, ListItemType.AlternatingItem);

            Assert.AreEqual(1, cell.Controls.Count, "#6");
            Assert.IsTrue(cell.Controls[0] is HyperLink, "#7");

            /* test that for Footer it just sets the cell.Text to FooterText */
            column            = new MyColumn();
            cell              = new TableCell();
            column.FooterText = "This is a Footer";
            column.InitCell(cell, 0, ListItemType.Footer);

            Assert.AreEqual("This is a Footer", cell.Text, "#8");
        }
示例#3
0
		public void InitCellTest ()
		{
			MyColumn column;
			TableCell cell;

			/* test that for Header it just sets the cell.Text to HeaderText */
			column = new MyColumn();
			cell = new TableCell();
			column.HeaderText = "This is a Header";
			column.InitCell (cell, 0, ListItemType.Header);

			Assert.AreEqual ("This is a Header", cell.Text, "#1");

			/* test that for Item it adds a HyperLinkControl */
			column = new MyColumn();
			cell = new TableCell();
			column.NavigateUrl = "http://www.novell.com/";
			column.Text = "Novell.com";
			column.InitCell (cell, 0, ListItemType.Item);

			Assert.AreEqual (1, cell.Controls.Count, "#2");
			Assert.IsTrue (cell.Controls[0] is HyperLink, "#3");

			/* test that for EditItem it adds a HyperLinkControl */
			column = new MyColumn();
			cell = new TableCell();
			column.NavigateUrl = "http://www.novell.com/";
			column.Text = "Novell.com";
			column.InitCell (cell, 0, ListItemType.EditItem);

			Assert.AreEqual (1, cell.Controls.Count, "#4");
			Assert.IsTrue (cell.Controls[0] is HyperLink, "#5");

			/* test that for AlternatingItem it adds a HyperLinkControl */
			column = new MyColumn();
			cell = new TableCell();
			column.NavigateUrl = "http://www.novell.com/";
			column.Text = "Novell.com";
			column.InitCell (cell, 0, ListItemType.AlternatingItem);

			Assert.AreEqual (1, cell.Controls.Count, "#6");
			Assert.IsTrue (cell.Controls[0] is HyperLink, "#7");

			/* test that for Footer it just sets the cell.Text to FooterText */
			column = new MyColumn();
			cell = new TableCell();
			column.FooterText = "This is a Footer";
			column.InitCell (cell, 0, ListItemType.Footer);

			Assert.AreEqual ("This is a Footer", cell.Text, "#8");
		}
示例#4
0
		public void FormatTest ()
		{
			MyColumn column = new MyColumn ();
			column.DataNavigateUrlFormatString = "!{0}!";
			Assert.AreEqual (String.Empty, column.FormatUrl (null), "#1");
			Assert.AreEqual ("!foo!", column.FormatUrl ("foo"), "#2");

			column.DataTextFormatString = "!{0}!";
			Assert.AreEqual (String.Empty, column.FormatText (null), "#3");
			Assert.AreEqual ("!foo!", column.FormatText ("foo"), "#4");
		}