Inheritance: System.Web.UI.WebControls.CheckBoxList
Ejemplo n.º 1
0
        public void FindControl()
        {
            CheckBoxListPoker p = new CheckBoxListPoker();

            p.ID = "id";
            p.Items.Add("one");
            p.Items.Add("two");
            p.Items.Add("three");

            // Everything seems to return this.
            Assert.AreEqual(p.FindControlPoke(String.Empty, 0), p, "A1");
            Assert.AreEqual(p.FindControlPoke("id", 0), p, "A2");
            Assert.AreEqual(p.FindControlPoke("id_0", 0), p, "A3");
            Assert.AreEqual(p.FindControlPoke("id_1", 0), p, "A4");
            Assert.AreEqual(p.FindControlPoke("id_2", 0), p, "A5");
            Assert.AreEqual(p.FindControlPoke("id_3", 0), p, "A6");
            Assert.AreEqual(p.FindControlPoke("0", 0), p, "A7");

            Assert.AreEqual(p.FindControlPoke(String.Empty, 10), p, "A1");
            Assert.AreEqual(p.FindControlPoke("id", 10), p, "A2");
            Assert.AreEqual(p.FindControlPoke("id_0", 10), p, "A3");
            Assert.AreEqual(p.FindControlPoke("id_1", 10), p, "A4");
            Assert.AreEqual(p.FindControlPoke("id_2", 10), p, "A5");
            Assert.AreEqual(p.FindControlPoke("id_3", 10), p, "A6");
            Assert.AreEqual(p.FindControlPoke("0", 10), p, "A7");
        }
Ejemplo n.º 2
0
        public void RaisePostDataChangedEvent()
        {
            CheckBoxListPoker c = new CheckBoxListPoker();

            c.SelectedIndexChanged += new EventHandler(c_SelectedIndexChanged);
            Assert.AreEqual(false, eventSelectedIndexChanged, "RaisePostDataChangedEvent#1");
            c.RaisePostDataChangedEvent();
            Assert.AreEqual(true, eventSelectedIndexChanged, "RaisePostDataChangedEvent#2");
        }
Ejemplo n.º 3
0
        public void RepeatedItemCount()
        {
            CheckBoxListPoker c  = new CheckBoxListPoker();
            ListItem          l1 = new ListItem("item1", "value1");
            ListItem          l2 = new ListItem("item2", "value2");

            Assert.AreEqual(0, c.RepeatedItemCount, "RepeatedItemCount#1");
            c.Items.Add(l1);
            c.Items.Add(l2);
            Assert.AreEqual(2, c.RepeatedItemCount, "RepeatedItemCount#2");
        }
Ejemplo n.º 4
0
        public static void GetItemStyle_Load(Page p)
        {
            CheckBoxListPoker c  = new CheckBoxListPoker();
            ListItem          l1 = new ListItem("item1", "value1");
            ListItem          l2 = new ListItem("item2", "value2");

            c.Items.Add(l1);
            c.Items.Add(l2);
            p.Form.Controls.Add(new LiteralControl(HtmlDiff.BEGIN_TAG));
            p.Form.Controls.Add(c);
            p.Form.Controls.Add(new LiteralControl(HtmlDiff.END_TAG));
        }
Ejemplo n.º 5
0
        public void RenderItem()
        {
            CheckBoxListPoker c  = new CheckBoxListPoker();
            ListItem          l1 = new ListItem("item1", "value1");
            ListItem          l2 = new ListItem("item2", "value2");

            c.Items.Add(l1);
            c.Items.Add(l2);
            string html = c.RenderItem(ListItemType.Item, 0, null);

            HtmlDiff.AssertAreEqual("<input id=\"0\" type=\"checkbox\" name=\"0\" /><label for=\"0\">item1</label>", html, "RenderItem#1");
            html = c.RenderItem(ListItemType.Item, 1, null);
            HtmlDiff.AssertAreEqual("<input id=\"1\" type=\"checkbox\" name=\"1\" /><label for=\"1\">item2</label>", html, "RenderItem#2");
        }
Ejemplo n.º 6
0
        public void Defaults()
        {
            CheckBoxListPoker c = new CheckBoxListPoker();

            Assert.AreEqual(c.CellPadding, -1, "A1");
            Assert.AreEqual(c.CellSpacing, -1, "A2");
            Assert.AreEqual(c.RepeatColumns, 0, "A3");
            Assert.AreEqual(c.RepeatDirection,
                            RepeatDirection.Vertical, "A4");
            Assert.AreEqual(c.RepeatLayout,
                            RepeatLayout.Table, "A5");
            Assert.AreEqual(c.TextAlign, TextAlign.Right, "A6");
            Assert.AreEqual(false, c.HasFooter, "HasFooter");
            Assert.AreEqual(false, c.HasHeader, "HasHeader");
            Assert.AreEqual(false, c.HasSeparators, "HasSeparators");
            Assert.AreEqual(0, c.RepeatedItemCount, "RepeatedItemCount");
            Assert.AreEqual(null, c.DoGetItemStyle(ListItemType.Item, 0), "GetItemStyle");
        }
		public void FindControl ()
		{
			CheckBoxListPoker p = new CheckBoxListPoker ();

			p.ID = "id";
			p.Items.Add ("one");
			p.Items.Add ("two");
			p.Items.Add ("three");

			// Everything seems to return this.
			Assert.AreEqual (p.FindControlPoke (String.Empty, 0), p, "A1");
			Assert.AreEqual (p.FindControlPoke ("id", 0), p, "A2");
			Assert.AreEqual (p.FindControlPoke ("id_0", 0), p, "A3");
			Assert.AreEqual (p.FindControlPoke ("id_1", 0), p, "A4");
			Assert.AreEqual (p.FindControlPoke ("id_2", 0), p, "A5");
			Assert.AreEqual (p.FindControlPoke ("id_3", 0), p, "A6");
			Assert.AreEqual (p.FindControlPoke ("0", 0), p, "A7");

			Assert.AreEqual (p.FindControlPoke (String.Empty, 10), p, "A1");
			Assert.AreEqual (p.FindControlPoke ("id", 10), p, "A2");
			Assert.AreEqual (p.FindControlPoke ("id_0", 10), p, "A3");
			Assert.AreEqual (p.FindControlPoke ("id_1", 10), p, "A4");
			Assert.AreEqual (p.FindControlPoke ("id_2", 10), p, "A5");
			Assert.AreEqual (p.FindControlPoke ("id_3", 10), p, "A6");
			Assert.AreEqual (p.FindControlPoke ("0", 10), p, "A7");
		}
		public void CreateStyle ()
		{
			CheckBoxListPoker c = new CheckBoxListPoker ();
			Assert.AreEqual (c.CreateStyle ().GetType (), typeof (TableStyle), "A1");
		}
		public void RepeatedItemCount ()
		{
			CheckBoxListPoker c = new CheckBoxListPoker ();
			ListItem l1 = new ListItem ("item1", "value1");
			ListItem l2 = new ListItem ("item2", "value2");
			Assert.AreEqual (0, c.RepeatedItemCount, "RepeatedItemCount#1");
			c.Items.Add (l1);
			c.Items.Add (l2);
			Assert.AreEqual (2, c.RepeatedItemCount, "RepeatedItemCount#2");
		}
		public void RenderItem ()
		{
#if NET_4_0
			string origHtml1 = "<input id=\"0\" type=\"checkbox\" name=\"0\" value=\"value1\" /><label for=\"0\">item1</label>";
			string origHtml2 = "<input id=\"1\" type=\"checkbox\" name=\"1\" value=\"value2\" /><label for=\"1\">item2</label>";
#else
			string origHtml1 = "<input id=\"0\" type=\"checkbox\" name=\"0\" /><label for=\"0\">item1</label>";
			string origHtml2 = "<input id=\"1\" type=\"checkbox\" name=\"1\" /><label for=\"1\">item2</label>";
#endif
			CheckBoxListPoker c = new CheckBoxListPoker ();
			ListItem l1 = new ListItem ("item1", "value1");
			ListItem l2 = new ListItem ("item2", "value2");

			c.Items.Add (l1);
			c.Items.Add (l2);
			string html = c.RenderItem (ListItemType.Item, 0, null);
			HtmlDiff.AssertAreEqual (origHtml1, html, "RenderItem#1");
			html = c.RenderItem (ListItemType.Item, 1, null);
			HtmlDiff.AssertAreEqual (origHtml2, html, "RenderItem#2");
		}
		public static void GetItemStyle_Load (Page p)
		{
			CheckBoxListPoker c = new CheckBoxListPoker ();
			ListItem l1 = new ListItem ("item1", "value1");
			ListItem l2 = new ListItem ("item2", "value2");

			c.Items.Add (l1);
			c.Items.Add (l2);
			p.Form.Controls.Add(new LiteralControl(HtmlDiff.BEGIN_TAG));
			p.Form.Controls.Add (c);
			p.Form.Controls.Add(new LiteralControl(HtmlDiff.END_TAG));
		}
		public void RaisePostDataChangedEvent ()
		{
			CheckBoxListPoker c = new CheckBoxListPoker ();
			c.SelectedIndexChanged += new EventHandler (c_SelectedIndexChanged);
			Assert.AreEqual (false, eventSelectedIndexChanged, "RaisePostDataChangedEvent#1");
			c.RaisePostDataChangedEvent ();
			Assert.AreEqual (true, eventSelectedIndexChanged, "RaisePostDataChangedEvent#2");
		}
		public void Defaults ()
		{
			CheckBoxListPoker c = new CheckBoxListPoker ();

			Assert.AreEqual (c.CellPadding, -1, "A1");
			Assert.AreEqual (c.CellSpacing, -1, "A2");
			Assert.AreEqual (c.RepeatColumns, 0, "A3");
			Assert.AreEqual (c.RepeatDirection,
					RepeatDirection.Vertical, "A4");
			Assert.AreEqual (c.RepeatLayout,
					RepeatLayout.Table, "A5");
			Assert.AreEqual (c.TextAlign, TextAlign.Right, "A6");
			Assert.AreEqual (false, c.HasFooter, "HasFooter");
			Assert.AreEqual (false, c.HasHeader, "HasHeader");
			Assert.AreEqual (false, c.HasSeparators, "HasSeparators");
			Assert.AreEqual (0, c.RepeatedItemCount, "RepeatedItemCount");
			Assert.AreEqual (null, c.DoGetItemStyle (ListItemType.Item, 0), "GetItemStyle");
		}
Ejemplo n.º 14
0
        public void CreateStyle()
        {
            CheckBoxListPoker c = new CheckBoxListPoker();

            Assert.AreEqual(c.CreateStyle().GetType(), typeof(TableStyle), "A1");
        }