コード例 #1
0
        public void UniqueID1()
        {
            // Standalone NC
            Control nc = new MyNC();

            Assert.IsNull(nc.UniqueID, "nulltest");
        }
コード例 #2
0
        public void UniqueID4()
        {
            // NC in control
            Control control = new Control();
            Control nc      = new MyNC();

            nc.Controls.Add(control);
            Assert.IsNotNull(control.UniqueID, "notnull");
        }
コード例 #3
0
        public void UniqueID3()
        {
            // NC in control
            Control control = new Control();
            Control nc      = new MyNC();

            control.Controls.Add(nc);
            Assert.IsNull(nc.UniqueID, "null");
        }
コード例 #4
0
        public void UniqueID1_1()
        {
            // Standalone NC
            Control nc = new MyNC();
            Page    p  = new Page();

            p.Controls.Add(nc);
            Assert.IsNotNull(nc.UniqueID, "notnull");
        }
コード例 #5
0
        public void UniqueID2()
        {
            // NC in NC
            Control nc  = new MyNC();
            Control nc2 = new MyNC();

            nc2.Controls.Add(nc);
            Assert.IsNotNull(nc.UniqueID, "notnull");
            Assert.IsTrue(nc.UniqueID.IndexOfAny(new char[] { ':', '$' }) == -1, "separator");
        }
コード例 #6
0
        public void DataBind()
        {
            MyNC ctrl = new MyNC();

            ctrl.DataBinding += new EventHandler(ctrl_DataBinding);
            Assert.AreEqual(false, _eventDataBinding, "Before DataBinding");
            ctrl.DataBind(false);
            Assert.AreEqual(false, _eventDataBinding, "Before DataBinding");
            ctrl.DataBind(true);
            Assert.AreEqual(true, _eventDataBinding, "After DataBinding");
        }
コード例 #7
0
        public void UniqueID6()
        {
            // NC in NC
            Control nc = new MyNC();
            Page    p  = new Page();

            p.Controls.Add(nc);
            Assert.IsNotNull(nc.UniqueID, "notnull");

            Control c1 = new Control();
            Control c2 = new Control();

            nc.Controls.Add(c1);
            nc.Controls.Add(c2);
            string uid1_1 = c1.UniqueID;
            string uid2_1 = c2.UniqueID;

            nc.Controls.Clear();

            Assert.IsNull(c1.UniqueID);
            Assert.IsNull(c2.UniqueID);

            // ad in another order
            nc.Controls.Add(c2);
            nc.Controls.Add(c1);
            string uid1_2 = c1.UniqueID;
            string uid2_2 = c2.UniqueID;

            Assert.IsFalse(uid1_1 == uid1_2);
            Assert.IsFalse(uid2_1 == uid2_2);
            Assert.AreEqual(uid1_1, uid2_2);
            Assert.AreEqual(uid2_1, uid1_2);

            nc.Controls.Remove(c1);
            nc.Controls.Add(c1);
            string uid1_3 = c1.UniqueID;

            Assert.IsFalse(uid1_3 == uid1_2, "id was not reset");

#if NET_2_0
            EnsureIDControl c3 = new EnsureIDControl();
            nc.Controls.Add(c3);
            string uid3_1 = c3.UniqueID;
            c3.DoEnsureID();
            Assert.IsNotNull(c3.ID);
            nc.Controls.Remove(c3);
            nc.Controls.Add(c3);
            string uid3_2 = c3.UniqueID;
            Assert.IsNull(c3.ID);
            Assert.IsFalse(uid3_1 == uid3_2, "id was not reset");
#endif
        }
コード例 #8
0
        public void UniqueID5()
        {
            // NC in control
            Control control = new Control();
            Control nc      = new MyNC();
            Control nc2     = new MyNC();

            nc2.Controls.Add(nc);
            nc.Controls.Add(control);
            Assert.IsNotNull(control.UniqueID, "notnull");
            Assert.IsNull(nc2.ID, "null-1");
            Assert.IsNull(nc.ID, "null-2");
            Assert.IsTrue(-1 != control.UniqueID.IndexOfAny(new char[] { ':', '$' }), "separator");
        }
コード例 #9
0
        public void HasEvent()
        {
            MyNC ctrl1 = new MyNC();

            Assert.AreEqual(false, ctrl1.HasEvents(), "HasEvent#1");
            EventHandler ctrl_hdlr = new EventHandler(ctrl1_Init);

            ctrl1.Init += new EventHandler(ctrl1_Init);
            ctrl1.Init += ctrl_hdlr;
            Assert.AreEqual(true, ctrl1.HasEvents(), "HasEvent#2");
            // Dosn't work than removed handler
            //ctrl1.Init -= ctrl_hdlr;
            //Assert.AreEqual (false, ctrl1.HasEvents (), "HasEvent#3");
        }
コード例 #10
0
        public void NameIsUniqueID()
        {
            ListBoxPoker list = new ListBoxPoker();
            Page         page = new Page();

            page.ID = "pg";
            Control ctrl = new MyNC();

            ctrl.ID = "ctrl";
            page.Controls.Add(ctrl);
            ctrl.Controls.Add(list);
            string str = list.Render();

            Assert.IsTrue(-1 != list.Render().IndexOf(':'), "unique");
        }
コード例 #11
0
        public void DataBindChildren()
        {
            MyNC    ctrl1 = new MyNC();
            Control ctrl2 = new Control();
            Control ctrl3 = new Control();

            ctrl2.DataBinding += new EventHandler(ctrl2_DataBinding);
            ctrl3.DataBinding += new EventHandler(ctrl3_DataBinding);

            ctrl2.Controls.Add(ctrl3);
            ctrl1.Controls.Add(ctrl2);
            Assert.AreEqual(false, _eventChild1, "Before DataBinding#1");
            Assert.AreEqual(false, _eventChild2, "Before DataBinding#2");
            ctrl1.DataBindChildren();
            Assert.AreEqual(true, _eventChild1, "After DataBinding#1");
            Assert.AreEqual(true, _eventChild2, "After DataBinding#2");
        }
コード例 #12
0
        public void ClientID()
        {
            // NC in control
            Control control = new Control();
            Control nc      = new MyNC();
            Control nc2     = new MyNC();
            Control nc3     = new MyNC();

            nc3.Controls.Add(nc2);
            nc2.Controls.Add(nc);
            nc.Controls.Add(control);
#if NET_2_0
            string expected = "ctl00_ctl00_ctl00";
#else
            string expected = "_ctl0__ctl0__ctl0";
#endif
            Assert.AreEqual(expected, control.ClientID, "ClientID");
        }
コード例 #13
0
        public void EnsureID()
        {
            MyNC ctrl  = new MyNC();
            MyNC ctrl1 = new MyNC();

            ctrl.Controls.Add(ctrl1);
            Page p = new Page();

            p.Controls.Add(ctrl);
            ctrl.EnsureID();
            if (String.IsNullOrEmpty(ctrl.ID))
            {
                Assert.Fail("EnsureID#1");
            }
            ctrl1.EnsureID();
            if (String.IsNullOrEmpty(ctrl1.ID))
            {
                Assert.Fail("EnsureID#2");
            }
        }
コード例 #14
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void DataBindChildren ()
		{
			MyNC ctrl1 = new MyNC ();
			Control ctrl2 = new Control ();
			Control ctrl3 = new Control ();
			ctrl2.DataBinding += new EventHandler (ctrl2_DataBinding);
			ctrl3.DataBinding += new EventHandler (ctrl3_DataBinding);

			ctrl2.Controls.Add (ctrl3);
			ctrl1.Controls.Add (ctrl2);
			Assert.AreEqual (false, _eventChild1, "Before DataBinding#1");
			Assert.AreEqual (false, _eventChild2, "Before DataBinding#2");
			ctrl1.DataBindChildren ();
			Assert.AreEqual (true, _eventChild1, "After DataBinding#1");
			Assert.AreEqual (true, _eventChild2, "After DataBinding#2");
		}
コード例 #15
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void DataBind ()
		{
			MyNC ctrl = new MyNC ();
			ctrl.DataBinding += new EventHandler (ctrl_DataBinding);
			Assert.AreEqual (false, _eventDataBinding, "Before DataBinding");
			ctrl.DataBind (false);
			Assert.AreEqual (false, _eventDataBinding, "Before DataBinding");
			ctrl.DataBind (true);
			Assert.AreEqual (true, _eventDataBinding, "After DataBinding");
		}
コード例 #16
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void ClientID () 
		{
			// NC in control
			Control control = new Control ();
			Control nc = new MyNC ();
			Control nc2 = new MyNC ();
			Control nc3 = new MyNC ();

			nc3.Controls.Add (nc2);
			nc2.Controls.Add (nc);
			nc.Controls.Add (control);
#if NET_2_0
			string expected = "ctl00_ctl00_ctl00";
#else
			string expected = "_ctl0__ctl0__ctl0";
#endif
			Assert.AreEqual (expected, control.ClientID, "ClientID");
		}
コード例 #17
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void UniqueID6 () {
			// NC in NC
			Control nc = new MyNC ();
			Page p = new Page ();
			p.Controls.Add (nc);
			Assert.IsNotNull (nc.UniqueID, "notnull");

			Control c1 = new Control ();
			Control c2 = new Control ();
			nc.Controls.Add (c1);
			nc.Controls.Add (c2);
			string uid1_1 = c1.UniqueID;
			string uid2_1 = c2.UniqueID;

			nc.Controls.Clear ();

			Assert.IsNull (c1.UniqueID);
			Assert.IsNull (c2.UniqueID);

			// ad in another order
			nc.Controls.Add (c2);
			nc.Controls.Add (c1);
			string uid1_2 = c1.UniqueID;
			string uid2_2 = c2.UniqueID;

			Assert.IsFalse (uid1_1 == uid1_2);
			Assert.IsFalse (uid2_1 == uid2_2);
			Assert.AreEqual (uid1_1, uid2_2);
			Assert.AreEqual (uid2_1, uid1_2);

			nc.Controls.Remove (c1);
			nc.Controls.Add (c1);
			string uid1_3 = c1.UniqueID;
			Assert.IsFalse (uid1_3 == uid1_2, "id was not reset");

#if NET_2_0
			EnsureIDControl c3 = new EnsureIDControl ();
			nc.Controls.Add (c3);
			string uid3_1 = c3.UniqueID;
			c3.DoEnsureID ();
			Assert.IsNotNull (c3.ID);
			nc.Controls.Remove (c3);
			nc.Controls.Add (c3);
			string uid3_2 = c3.UniqueID;
			Assert.IsNull (c3.ID);
			Assert.IsFalse (uid3_1 == uid3_2, "id was not reset");
#endif
		}
コード例 #18
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void UniqueID5 ()
		{
			// NC in control
			Control control = new Control ();
			Control nc = new MyNC ();
			Control nc2 = new MyNC ();

			nc2.Controls.Add (nc);
			nc.Controls.Add (control);
			Assert.IsNotNull (control.UniqueID, "notnull");
			Assert.IsNull (nc2.ID, "null-1");
			Assert.IsNull (nc.ID, "null-2");
			Assert.IsTrue (-1 != control.UniqueID.IndexOfAny (new char[] { ':', '$' }), "separator");
		}
コード例 #19
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void UniqueID4 ()
		{
			// NC in control
			Control control = new Control ();
			Control nc = new MyNC ();

			nc.Controls.Add (control);
			Assert.IsNotNull (control.UniqueID, "notnull");
		}
コード例 #20
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void UniqueID3 ()
		{
			// NC in control
			Control control = new Control ();
			Control nc = new MyNC ();

			control.Controls.Add (nc);
			Assert.IsNull (nc.UniqueID, "null");
		}
コード例 #21
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void UniqueID2_1 () {
			// NC in NC
			Control nc = new MyNC ();
			Control nc2 = new MyNC ();
			nc2.Controls.Add (nc);
			Page p = new Page ();
			p.Controls.Add (nc2);
			Assert.IsNotNull (nc.UniqueID, "notnull");
			Assert.IsTrue (nc.UniqueID.IndexOfAny (new char [] { ':', '$' }) != -1, "separator");
		}
コード例 #22
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void UniqueID1_1 () {
			// Standalone NC
			Control nc = new MyNC ();
			Page p = new Page ();
			p.Controls.Add (nc);
			Assert.IsNotNull (nc.UniqueID, "notnull");
		}
コード例 #23
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void Control_Adapter ()
		{
			MyNC ctr = new MyNC ();
			Assert.AreEqual (null, ctr.Adapter (), "Adapter");
		}
コード例 #24
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void EnsureID ()
		{
			MyNC ctrl = new MyNC ();
			MyNC ctrl1 = new MyNC ();
			ctrl.Controls.Add (ctrl1);
			Page p = new Page ();
			p.Controls.Add (ctrl);
			ctrl.EnsureID ();
			if (String.IsNullOrEmpty (ctrl.ID))
				Assert.Fail ("EnsureID#1");
			ctrl1.EnsureID ();
			if (String.IsNullOrEmpty (ctrl1.ID))
				Assert.Fail ("EnsureID#2");
		}
コード例 #25
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void HasEvent ()
		{
			MyNC ctrl1 = new MyNC ();
			Assert.AreEqual (false, ctrl1.HasEvents (), "HasEvent#1");
			EventHandler ctrl_hdlr = new EventHandler (ctrl1_Init);
			ctrl1.Init += new EventHandler (ctrl1_Init);
			ctrl1.Init += ctrl_hdlr;
			Assert.AreEqual (true, ctrl1.HasEvents (), "HasEvent#2");
			// Dosn't work than removed handler
			//ctrl1.Init -= ctrl_hdlr;
			//Assert.AreEqual (false, ctrl1.HasEvents (), "HasEvent#3");
		}
コード例 #26
0
ファイル: ControlTest.cs プロジェクト: carrie901/mono
		public void UniqueID1 ()
		{
			// Standalone NC
			Control nc = new MyNC ();
			Assert.IsNull (nc.UniqueID, "nulltest");
		}
コード例 #27
0
ファイル: ListBoxTest.cs プロジェクト: Profit0004/mono
		public void NameIsUniqueID ()
		{
			ListBoxPoker list = new ListBoxPoker ();
			Page page = new Page ();
			page.ID = "pg";
			Control ctrl = new MyNC ();
			ctrl.ID = "ctrl";
			page.Controls.Add (ctrl);
			ctrl.Controls.Add (list);
			string str = list.Render();
			Assert.IsTrue (-1 != list.Render ().IndexOf (':'), "unique");
		}
コード例 #28
0
        public void Control_Adapter()
        {
            MyNC ctr = new MyNC();

            Assert.AreEqual(null, ctr.Adapter(), "Adapter");
        }