Example #1
0
        public void DetailsView_CreateChildControls_Clear()
        {
            MyCompositeDataBoundControl c = new MyCompositeDataBoundControl();

            c.Controls.Add(new WebControl(HtmlTextWriterTag.A));
            Assert.AreEqual(1, c.Controls.Count);
            c.DoCreateChildControls();
            Assert.AreEqual(0, c.Controls.Count);
        }
Example #2
0
        public void DetailsView_CreateChildControls_Clear2()
        {
            MyCompositeDataBoundControl c = new MyCompositeDataBoundControl();

            c.Controls.Add(new WebControl(HtmlTextWriterTag.A));
            Assert.AreEqual(1, c.Controls.Count, "Controls.Count before DataBind");
            c.DataBind();
            Assert.AreEqual(0, c.CreateChildControls_Controls_Count, "Controls.Count in CreateChildControls");
            Assert.AreEqual(0, c.Controls.Count, "Controls.Count after DataBind");
        }
Example #3
0
        public void DetailsView_EnsureChildControlsFlow()
        {
            MyCompositeDataBoundControl c = new MyCompositeDataBoundControl();

            Assert.IsFalse(c.GetRequiresDataBinding());
            c.DoEnsureChildControls();
            Assert.IsTrue(c.ensureCreateChildControls);
            Assert.IsFalse(c.ensureDataBound);
            Assert.IsFalse(c.dataBind);
            Assert.IsTrue(c.createChildControls1);
            Assert.IsFalse(c.createChildControls2);
        }
Example #4
0
        public void DataBind_ChildControlsCreated()
        {
            Page p = new Page();
            MyCompositeDataBoundControl c = new MyCompositeDataBoundControl();

            p.Controls.Add(c);
            Assert.IsFalse(c.GetChildControlsCreated(), "ChildControlsCreated before DataBind");
            c.DataBind();
            Assert.IsTrue(c.ensureCreateChildControls);
            Assert.IsTrue(c.createChildControls1);
            Assert.IsTrue(c.createChildControls2);
            Assert.IsTrue(c.CreateChildControls_ChildControlsCreated, "ChildControlsCreated in CreateChildControls");
            Assert.IsTrue(c.GetChildControlsCreated(), "ChildControlsCreated after DataBind");
        }
		public void DataBind_ChildControlsCreated () {
			Page p = new Page ();
			MyCompositeDataBoundControl c = new MyCompositeDataBoundControl ();
			p.Controls.Add (c);
			Assert.IsFalse (c.GetChildControlsCreated (), "ChildControlsCreated before DataBind");
			c.DataBind ();
			Assert.IsTrue (c.ensureCreateChildControls);
			Assert.IsTrue (c.createChildControls1);
			Assert.IsTrue (c.createChildControls2);
			Assert.IsTrue (c.CreateChildControls_ChildControlsCreated, "ChildControlsCreated in CreateChildControls");
			Assert.IsTrue (c.GetChildControlsCreated (), "ChildControlsCreated after DataBind");
		}
		public void DetailsView_CreateChildControls_Clear2 () {
			MyCompositeDataBoundControl c = new MyCompositeDataBoundControl ();
			c.Controls.Add (new WebControl (HtmlTextWriterTag.A));
			Assert.AreEqual (1, c.Controls.Count, "Controls.Count before DataBind");
			c.DataBind ();
			Assert.AreEqual (0, c.CreateChildControls_Controls_Count, "Controls.Count in CreateChildControls");
			Assert.AreEqual (0, c.Controls.Count, "Controls.Count after DataBind");

		}
		public void DetailsView_CreateChildControls_Clear () {
			MyCompositeDataBoundControl c = new MyCompositeDataBoundControl ();
			c.Controls.Add (new WebControl (HtmlTextWriterTag.A));
			Assert.AreEqual (1, c.Controls.Count);
			c.DoCreateChildControls ();
			Assert.AreEqual (0, c.Controls.Count);
		}
		public void DetailsView_EnsureChildControlsFlow2 () {
			MyCompositeDataBoundControl c = new MyCompositeDataBoundControl ();
			c.SetRequiresDataBinding (true);
			Assert.IsTrue (c.GetRequiresDataBinding ());
			c.DoEnsureChildControls ();
			Assert.IsTrue (c.ensureCreateChildControls);
			Assert.IsTrue (c.ensureDataBound);
			Assert.IsFalse (c.dataBind);
			Assert.IsTrue (c.createChildControls1);
			Assert.IsFalse (c.createChildControls2);
		}