예제 #1
0
        public void CleanProperties()
        {
            TestRadioButton r = new TestRadioButton();

            r.Text = "text";
            Assert.AreEqual("text", r.Text, "Text");
            r.AutoPostBack = true;
            r.TextAlign    = TextAlign.Left;
            r.Checked      = true;
            r.GroupName    = "groupname";
            Assert.AreEqual("groupname", r.GroupName, "GroupName");

            Assert.AreEqual(5, r.StateBag.Count, "ViewState.Count");
            Assert.AreEqual(0, r.Attributes.Count, "Attributes.Count");

            r.Text         = null;
            r.AutoPostBack = false;
            r.TextAlign    = TextAlign.Right;
            r.Checked      = false;
            r.GroupName    = null;

            // If Text is null it is removed from the
            // ViewState.  Ditto GroupName
            Assert.AreEqual(3, r.StateBag.Count, "ViewState.Count-2");
            Assert.AreEqual(TextAlign.Right, r.StateBag["TextAlign"], "TextAlign");
            Assert.AreEqual(0, r.Attributes.Count, "Attributes.Count-2");
        }
예제 #2
0
		public void RaisePostDataChangedEvent ()
		{
			TestRadioButton b = new TestRadioButton ();
			b.CheckedChanged += new EventHandler (b_CheckedChanged);
			Assert.AreEqual (false, eventCheckedChanged, "before");
			b.RaisePostDataChangedEvent ();
			Assert.AreEqual (true, eventCheckedChanged, "after");
		}
예제 #3
0
		public void NameAttr2 () {
			TestRadioButton b1 = new TestRadioButton ();
			b1.ID = "monoId";
			Page p = new Page ();
#if NET_2_0
			p.EnableEventValidation = false;
#endif
			p.ID = "MyPage";
			p.Controls.Add (b1);
			string t1 = b1.Render ();
			Assert.IsTrue (t1.IndexOf ("name=\"monoId\"") != -1, "#01");
		}
예제 #4
0
		public void DefaultProperties ()
		{
			TestRadioButton r = new TestRadioButton ();
			
			Assert.AreEqual (0, r.Attributes.Count, "Attributes.Count");

			Assert.IsFalse (r.AutoPostBack, "AutoPostBack");
			Assert.IsFalse (r.Checked, "Checked");
			Assert.AreEqual (String.Empty, r.Text, "Text");
			Assert.AreEqual (TextAlign.Right, r.TextAlign, "TextAlign");
			Assert.AreEqual (String.Empty, r.GroupName, "GroupName");
			
			Assert.AreEqual (0, r.Attributes.Count, "Attributes.Count-2");
		}
예제 #5
0
        public void DefaultProperties()
        {
            TestRadioButton r = new TestRadioButton();

            Assert.AreEqual(0, r.Attributes.Count, "Attributes.Count");

            Assert.IsFalse(r.AutoPostBack, "AutoPostBack");
            Assert.IsFalse(r.Checked, "Checked");
            Assert.AreEqual(String.Empty, r.Text, "Text");
            Assert.AreEqual(TextAlign.Right, r.TextAlign, "TextAlign");
            Assert.AreEqual(String.Empty, r.GroupName, "GroupName");

            Assert.AreEqual(0, r.Attributes.Count, "Attributes.Count-2");
        }
예제 #6
0
		public static void RaisePostDataChangedEvent_Init (Page p)
		{
			TestRadioButton b = new TestRadioButton ();
			b.ID = "RadioButton1";
			b.GroupName = "RadioButton1";
			b.CheckedChanged+=new EventHandler(event_CheckedChanged);
			p.Form.Controls.Add (b);
			
			TestRadioButton b2 = new TestRadioButton ();
			b2.ID = "RadioButton2";
			b2.GroupName = "RadioButton1";
			b2.CheckedChanged += new EventHandler (event_CheckedChanged2);
			p.Form.Controls.Add (b2);
			if (!p.IsPostBack)
				b2.Checked = true;
		}
예제 #7
0
		public void NullProperties ()
		{
			TestRadioButton r = new TestRadioButton ();
			
			r.Text = null;
			Assert.AreEqual (String.Empty, r.Text, "Text");
			r.TextAlign = TextAlign.Right;
			Assert.AreEqual (TextAlign.Right, r.TextAlign, "TextAlign");
			r.AutoPostBack = true;
			Assert.IsTrue (r.AutoPostBack, "AutoPostBack");
			r.Checked = true;
			Assert.IsTrue (r.Checked, "Checked");
			r.GroupName = null;
			Assert.AreEqual (String.Empty, r.GroupName, "GroupName");
			
			Assert.AreEqual (0, r.Attributes.Count, "Attributes.Count");
			Assert.AreEqual (3, r.StateBag.Count, "ViewState.Count-1");
		}
예제 #8
0
        public void NullProperties()
        {
            TestRadioButton r = new TestRadioButton();

            r.Text = null;
            Assert.AreEqual(String.Empty, r.Text, "Text");
            r.TextAlign = TextAlign.Right;
            Assert.AreEqual(TextAlign.Right, r.TextAlign, "TextAlign");
            r.AutoPostBack = true;
            Assert.IsTrue(r.AutoPostBack, "AutoPostBack");
            r.Checked = true;
            Assert.IsTrue(r.Checked, "Checked");
            r.GroupName = null;
            Assert.AreEqual(String.Empty, r.GroupName, "GroupName");

            Assert.AreEqual(0, r.Attributes.Count, "Attributes.Count");
            Assert.AreEqual(3, r.StateBag.Count, "ViewState.Count-1");
        }
예제 #9
0
        public void Render()
        {
            TestRadioButton r = new TestRadioButton();

            string s = r.Render();

            Assert.IsTrue(s.IndexOf(" type=\"radio\"") > 0, "type");

            r.Text = "label text";
            s      = r.Render();
            Assert.IsTrue(s.IndexOf(">label text</label>") > 0, "text");

            r.TextAlign = TextAlign.Left;
            s           = r.Render();
            Assert.IsTrue(s.IndexOf(">label text</label><input") > 0, "text left");
            r.TextAlign = TextAlign.Right;
            s           = r.Render();
            Assert.IsTrue(s.IndexOf("/><label for") > 0, "text right");
        }
예제 #10
0
        public void NameAttr1()
        {
            TestRadioButton b1 = new TestRadioButton();

            b1.GroupName = "mono";
            TestRadioButton b2 = new TestRadioButton();

            b2.GroupName = "mono";
            Page p = new Page();

            p.EnableEventValidation = false;
            p.ID = "MyPage";
            p.Controls.Add(b1);
            p.Controls.Add(b2);
            string t1 = b1.Render();

            Assert.IsTrue(t1.IndexOf("name=\"mono\"") != -1, "#01");
            string t2 = b2.Render();

            Assert.IsTrue(t2.IndexOf("name=\"mono\"") != -1, "#02");
        }
예제 #11
0
		public void CleanProperties ()
		{
			TestRadioButton r = new TestRadioButton ();

			r.Text = "text";
			Assert.AreEqual ("text", r.Text, "Text");
			r.AutoPostBack = true;
			r.TextAlign = TextAlign.Left;
			r.Checked = true;
			r.GroupName = "groupname";
			Assert.AreEqual ("groupname", r.GroupName, "GroupName");
			
			Assert.AreEqual (5, r.StateBag.Count, "ViewState.Count");
			Assert.AreEqual (0, r.Attributes.Count, "Attributes.Count");

			r.Text = null;
			r.AutoPostBack = false;
			r.TextAlign = TextAlign.Right;
			r.Checked = false;
			r.GroupName = null;
			
			// If Text is null it is removed from the
			// ViewState.  Ditto GroupName
			Assert.AreEqual (3, r.StateBag.Count, "ViewState.Count-2");
			Assert.AreEqual (TextAlign.Right, r.StateBag["TextAlign"], "TextAlign");
			Assert.AreEqual (0, r.Attributes.Count, "Attributes.Count-2");
		}
예제 #12
0
		public static void RaisePostDataChangedEvent_Init (Page p)
		{
			TestRadioButton b = new TestRadioButton ();
			b.ID = "RadioButton1";
			b.GroupName = "RadioButton1";
			b.CheckedChanged+=new EventHandler(event_CheckedChanged);
			p.Form.Controls.Add (b);
			
			TestRadioButton b2 = new TestRadioButton ();
			b2.ID = "RadioButton2";
			b2.GroupName = "RadioButton1";
			b2.CheckedChanged += new EventHandler (event_CheckedChanged2);
			p.Form.Controls.Add (b2);
			if (!p.IsPostBack)
				b2.Checked = true;
		}
예제 #13
0
		public void RaisePostDataChangedEvent ()
		{
			TestRadioButton b = new TestRadioButton ();
			b.CheckedChanged += new EventHandler (b_CheckedChanged);
			Assert.AreEqual (false, eventCheckedChanged, "before");
			b.RaisePostDataChangedEvent ();
			Assert.AreEqual (true, eventCheckedChanged, "after");
		}
예제 #14
0
		public void NameAttr2 () {
			TestRadioButton b1 = new TestRadioButton ();
			b1.ID = "monoId";
			Page p = new Page ();
			p.EnableEventValidation = false;
			p.ID = "MyPage";
			p.Controls.Add (b1);
			string t1 = b1.Render ();
			Assert.IsTrue (t1.IndexOf ("name=\"monoId\"") != -1, "#01");
		}
예제 #15
0
		public void Render ()
		{
			TestRadioButton r = new TestRadioButton ();

			string s = r.Render ();

			Assert.IsTrue (s.IndexOf (" type=\"radio\"") > 0, "type");

			r.Text = "label text";
			s = r.Render ();
			Assert.IsTrue (s.IndexOf (">label text</label>") > 0, "text");

			r.TextAlign = TextAlign.Left;
			s = r.Render ();
			Assert.IsTrue (s.IndexOf (">label text</label><input") > 0, "text left");
			r.TextAlign = TextAlign.Right;
			s = r.Render ();
			Assert.IsTrue (s.IndexOf ("/><label for") > 0, "text right");
		}
예제 #16
0
		public void NameAttr1 ()
		{
			TestRadioButton b1 = new TestRadioButton ();
			b1.GroupName = "mono";
			TestRadioButton b2 = new TestRadioButton ();
			b2.GroupName = "mono";
			Page p = new Page ();
#if NET_2_0
			p.EnableEventValidation = false;
#endif
			p.ID = "MyPage";
			p.Controls.Add (b1);
			p.Controls.Add (b2);
			string t1 = b1.Render ();
			Assert.IsTrue (t1.IndexOf ("name=\"mono\"") != -1, "#01");
			string t2 = b2.Render ();
			Assert.IsTrue (t2.IndexOf ("name=\"mono\"") != -1, "#02");
		}