예제 #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");
        }
        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
		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
		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
		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
		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
		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
		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
		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
		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
		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
		public void Control_Adapter ()
		{
			MyNC ctr = new MyNC ();
			Assert.AreEqual (null, ctr.Adapter (), "Adapter");
		}
예제 #24
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");
		}
예제 #25
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");
		}
예제 #26
0
		public void UniqueID1 ()
		{
			// Standalone NC
			Control nc = new MyNC ();
			Assert.IsNull (nc.UniqueID, "nulltest");
		}
예제 #27
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");
		}
예제 #28
0
        public void Control_Adapter()
        {
            MyNC ctr = new MyNC();

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