Beispiel #1
0
        public void NullProperties()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(0, bdl.Attributes.Count, "Attributes.Count-1");
            Assert.AreEqual(0, bdl.StateBag.Count, "ViewState.Count-1");

            bdl.Caption = null;
            Assert.AreEqual(String.Empty, bdl.Caption, "Caption");
            bdl.CaptionAlign = TableCaptionAlign.NotSet;
            Assert.AreEqual(TableCaptionAlign.NotSet, bdl.CaptionAlign, "CaptionAlign");
            Assert.AreEqual(1, bdl.StateBag.Count, "ViewState.Count-2");

            // many properties can't be set without causing a InvalidCastException

            bdl.DataKeyField = null;
            Assert.AreEqual(String.Empty, bdl.DataKeyField, "DataKeyField");
            bdl.DataMember = null;
            Assert.AreEqual(String.Empty, bdl.DataMember, "DataMember");
            bdl.DataSource = null;
            Assert.IsNull(bdl.DataSource, "DataSource");
            bdl.UseAccessibleHeader = false;
            Assert.IsFalse(bdl.UseAccessibleHeader, "UseAccessibleHeader");
#if NET_2_0
            bdl.DataSourceID = String.Empty;
            Assert.AreEqual(String.Empty, bdl.DataSourceID, "DataSourceID");
            Assert.AreEqual(3, bdl.StateBag.Count, "ViewState.Count-3");
#else
            Assert.AreEqual(2, bdl.StateBag.Count, "ViewState.Count-3");
#endif
            Assert.AreEqual(0, bdl.Attributes.Count, "Attributes.Count-2");
        }
Beispiel #2
0
        public void HorizontalAlign_InvalidCastException()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(HorizontalAlign.NotSet, bdl.HorizontalAlign, "HorizontalAlign");
            bdl.HorizontalAlign = HorizontalAlign.NotSet;
        }
Beispiel #3
0
        public void DefaultProperties()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual("span", bdl.Tag, "TagName");

            Assert.AreEqual(0, bdl.Attributes.Count, "Attributes.Count-1");
            Assert.AreEqual(0, bdl.StateBag.Count, "ViewState.Count-1");

            Assert.AreEqual(String.Empty, bdl.Caption, "Caption");
            Assert.AreEqual(TableCaptionAlign.NotSet, bdl.CaptionAlign, "CaptionAlign");
            Assert.AreEqual(-1, bdl.CellPadding, "CellPadding");
            Assert.AreEqual(0, bdl.CellSpacing, "CellSpacing");
            Assert.AreEqual(0, bdl.Controls.Count, "Controls.Count");
            Assert.AreEqual(String.Empty, bdl.DataKeyField, "DataKeyField");
            Assert.AreEqual(String.Empty, bdl.DataMember, "DataMember");
            Assert.IsNull(bdl.DataSource, "DataSource");
            Assert.AreEqual(GridLines.Both, bdl.GridLines, "GridLines");
            Assert.AreEqual(HorizontalAlign.NotSet, bdl.HorizontalAlign, "HorizontalAlign");
            Assert.IsFalse(bdl.UseAccessibleHeader, "UseAccessibleHeader");
#if NET_2_0
            Assert.AreEqual(String.Empty, bdl.DataSourceID, "DataSourceID");
#endif
            Assert.AreEqual(0, bdl.Attributes.Count, "Attributes.Count-2");
            Assert.AreEqual(0, bdl.StateBag.Count, "ViewState.Count-2");

            Assert.AreEqual(0, bdl.DataKeys.Count, "DataKeys.Count");
            Assert.AreEqual(0, bdl.Attributes.Count, "Attributes.Count-3");
            // triggered by DataKeys, which makes DataKeysArray store its value.
            Assert.AreEqual(1, bdl.StateBag.Count, "ViewState.Count-3");
            Assert.AreEqual(typeof(ArrayList), bdl.StateBag ["DataKeys"].GetType(), "ViewState.Value-1");
        }
Beispiel #4
0
        public void CellSpacing_InvalidCastException()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(0, bdl.CellSpacing, "CellSpacing");
            bdl.CellSpacing = 0;
        }
Beispiel #5
0
        public void DataSource_IEnumerable()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.DataSource = GetData(2);
            Assert.IsNotNull(bdl.DataSource, "DataSource");
        }
Beispiel #6
0
        public void GridLines_InvalidCastException()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(GridLines.Both, bdl.GridLines, "GridLines");
            bdl.GridLines = GridLines.Both;
        }
Beispiel #7
0
        public void CellPadding_InvalidCastException()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(-1, bdl.CellPadding, "CellPadding");
            bdl.CellPadding = -1;
        }
Beispiel #8
0
        public void DataSource_IListSource()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.DataSource = GetDataSource(3);
            Assert.IsNotNull(bdl.DataSource, "DataSource");
        }
Beispiel #9
0
        public void Render()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.DataSource = GetDataSource(3);
            bdl.DataBind();
            Assert.AreEqual(String.Empty, bdl.Render());
        }
Beispiel #10
0
        public void OnDataSourceViewChanged()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.IsFalse(bdl.RequiresDataBind, "RequiresDataBind-1");
            bdl.BaseOnDataSourceViewChanged(this, EventArgs.Empty);
            Assert.IsTrue(bdl.RequiresDataBind, "RequiresDataBind-2");
        }
Beispiel #11
0
        public void GetData_WithUnexistingDataSourceID()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.Page         = new Page();
            bdl.DataSourceID = "mono";
            bdl.Data();
        }
Beispiel #12
0
        public void EnsureDataBound_WithoutDataSourceID()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.IsFalse(bdl.DataBindingCalled, "Before EnsureDataBound");
            bdl.Ensure();
            Assert.IsFalse(bdl.DataBindingCalled, "After EnsureDataBound");
        }
Beispiel #13
0
        public void Events()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            selectedIndexChangedEvent = false;
            bdl.SelectedIndexChanged += new EventHandler(SelectedIndexChangedHandler);
            bdl.DoSelectedIndexChanged(new EventArgs());
            Assert.IsTrue(selectedIndexChangedEvent, "selectedIndexChangedEvent");
        }
Beispiel #14
0
        public void OnDataBinding_False()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.IsFalse(bdl.DataBindingCalled, "Before DataBind");
            bdl.DataSource = GetDataSource(3);
            bdl.DataBindBool(false);
            Assert.IsFalse(bdl.DataBindingCalled, "After DataBind");
        }
Beispiel #15
0
        public void TableCaption()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            foreach (TableCaptionAlign tca in Enum.GetValues(typeof(TableCaptionAlign)))
            {
                bdl.CaptionAlign = tca;
            }
        }
Beispiel #16
0
        public void OnInit()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.IsFalse(bdl.IsInitialized, "Initialized-1");
            bdl.BaseOnInit(EventArgs.Empty);
            Assert.IsFalse(bdl.IsInitialized, "Initialized-2");
            // OnInit doesn't set Initialized to true
        }
Beispiel #17
0
        public void DataSourceID()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.IsFalse(bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID-1");
            bdl.DataSourceID = "mono";
            Assert.IsTrue(bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID-2");
            bdl.DataBind();
            Assert.IsTrue(bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID-3");
        }
Beispiel #18
0
        public void OnLoad_WithoutPage()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.IsFalse(bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID");
            Assert.IsTrue(bdl.EnableViewState, "EnabledViewState");
            Assert.IsNull(bdl.Page, "Page");
            bdl.BaseOnLoad(EventArgs.Empty);
            Assert.IsTrue(bdl.IsInitialized, "IsInitialized");
            Assert.IsFalse(bdl.RequiresDataBind, "RequiresDataBind");
        }
Beispiel #19
0
        public void OnDataBinding()
        {
            // does DataBind calls base.OnDataBinding (like most sample do)
            // or does it call the overriden OnDataBinding (which seems logical)
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.IsFalse(bdl.DataBindingCalled, "Before DataBind");
            bdl.DataSource = GetDataSource(3);
            bdl.DataBind();
            Assert.IsTrue(bdl.DataBindingCalled, "After DataBind");
        }
Beispiel #20
0
        public void AddParsedSubObject()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.Add(null);
            bdl.Add(new LiteralControl("mono"));
            bdl.Add(new DataListItem(0, ListItemType.Item));
            bdl.Add(String.Empty);
            bdl.Add(new Control());
            Assert.AreEqual(0, bdl.Controls.Count, "Controls");
            Assert.AreEqual(0, bdl.StateBag.Count, "StateBag");
        }
Beispiel #21
0
        public void SupportsDisabledAttribute()
        {
            var ver40 = new Version(4, 0);
            var ver35 = new Version(3, 5);
            var p     = new TestBaseDataList();

            Assert.AreEqual(ver40, p.RenderingCompatibility, "#A1-1");
            Assert.IsFalse(p.SupportsDisabledAttribute, "#A1-2");

            p.RenderingCompatibility = new Version(3, 5);
            Assert.AreEqual(ver35, p.RenderingCompatibility, "#A2-1");
            Assert.IsTrue(p.SupportsDisabledAttribute, "#A2-2");
        }
Beispiel #22
0
        public void OnLoad_WithPage()
        {
            TestBaseDataList bdl = new TestBaseDataList();
            Page             p   = new Page();

            bdl.Page = p;
            Assert.IsFalse(bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID-2");
            Assert.IsTrue(bdl.EnableViewState, "EnabledViewState-2");
            Assert.IsFalse(bdl.Page.IsPostBack, "IsPostBack-2");
            bdl.BaseOnLoad(EventArgs.Empty);
            Assert.IsTrue(bdl.IsInitialized, "IsInitialized-2");
            Assert.IsTrue(bdl.RequiresDataBind, "RequiresDataBind-2");
        }
Beispiel #23
0
        public void GetData()
        {
            Test2DataSource ds = new Test2DataSource();

            ds.ID = "mono";
            TestBaseDataList bdl = new TestBaseDataList();
            Page             p   = new Page();

            bdl.Page = p;
            ds.Page  = p;
            p.Controls.Add(ds);
            p.Controls.Add(bdl);
            bdl.DataSourceID = "mono";
            Assert.IsNotNull(bdl.Data(), "GetData");
        }
Beispiel #24
0
        public void OnLoad_WithDataSource()
        {
            XmlDataSource ds = new XmlDataSource();

            ds.ID = "mono";
            TestBaseDataList bdl = new TestBaseDataList();
            Page             p   = new Page();

            bdl.Page = p;
            p.Controls.Add(ds);
            p.Controls.Add(bdl);
            bdl.DataSourceID = "mono";
            Assert.IsTrue(bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID");
            Assert.IsTrue(bdl.EnableViewState, "EnabledViewState");
            Assert.IsFalse(bdl.Page.IsPostBack, "IsPostBack");
            bdl.BaseOnLoad(EventArgs.Empty);
            Assert.IsTrue(bdl.IsInitialized, "IsInitialized");
            Assert.IsTrue(bdl.RequiresDataBind, "RequiresDataBind");
        }
Beispiel #25
0
        public void OnDataPropertyChanged()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.DataPropertyChangedCalled = false;
            bdl.DataMember = String.Empty;
            Assert.IsTrue(bdl.DataPropertyChangedCalled, "OnDataPropertyChanged-DataMember");
            Assert.IsFalse(bdl.IsInitialized, "Initialized-DataMember");

            bdl.DataPropertyChangedCalled = false;
            bdl.DataSource = null;
            Assert.IsTrue(bdl.DataPropertyChangedCalled, "OnDataPropertyChanged-DataSource");
            Assert.IsFalse(bdl.IsInitialized, "Initialized-DataSource");

            bdl.DataPropertyChangedCalled = false;
            bdl.DataSourceID = String.Empty;
            Assert.IsTrue(bdl.DataPropertyChangedCalled, "OnDataPropertyChanged-DataSourceID");
            Assert.IsFalse(bdl.IsInitialized, "Initialized-DataSourceID");
        }
Beispiel #26
0
        public void EnsureDataBound_WithDataSourceID()
        {
            XmlDataSource ds = new XmlDataSource();

            ds.Data = "";
            ds.ID   = "mono";
            TestBaseDataList bdl = new TestBaseDataList();
            Page             p   = new Page();

            bdl.Page = p;
            p.Controls.Add(ds);
            p.Controls.Add(bdl);
            bdl.DataSourceID = "mono";

            Assert.IsFalse(bdl.DataBindingCalled, "Before EnsureDataBound");
            bdl.Ensure();
            Assert.IsFalse(bdl.DataBindingCalled, "After EnsureDataBound");

            bdl.BaseOnLoad(EventArgs.Empty);
            bdl.Ensure();
            Assert.IsTrue(bdl.DataBindingCalled, "After BaseOnLoad|RequiresDataBinding");
        }
Beispiel #27
0
        public void CleanProperties()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.Caption = "Mono";
            Assert.AreEqual("Mono", bdl.Caption, "Caption");
            bdl.CaptionAlign = TableCaptionAlign.Top;
            Assert.AreEqual(TableCaptionAlign.Top, bdl.CaptionAlign, "CaptionAlign");
            // many properties can't be set without causing a InvalidCastException
            bdl.DataKeyField = "key";
            Assert.AreEqual("key", bdl.DataKeyField, "DataKeyField");
            bdl.DataMember = "member";
            Assert.AreEqual("member", bdl.DataMember, "DataMember");
            bdl.DataSource = GetData(2);
            Assert.IsNotNull(bdl.DataSource, "DataSource");
            bdl.UseAccessibleHeader = true;
            Assert.IsTrue(bdl.UseAccessibleHeader, "UseAccessibleHeader");

            Assert.AreEqual(0, bdl.Attributes.Count, "Attributes.Count-1");
            Assert.AreEqual(5, bdl.StateBag.Count, "ViewState.Count-1");

            bdl.Caption = null;
            Assert.AreEqual(String.Empty, bdl.Caption, "-Caption");
            bdl.CaptionAlign = TableCaptionAlign.NotSet;
            Assert.AreEqual(TableCaptionAlign.NotSet, bdl.CaptionAlign, "-CaptionAlign");
            // many properties can't be set without causing a InvalidCastException
            bdl.DataKeyField = null;
            Assert.AreEqual(String.Empty, bdl.DataKeyField, "-DataKeyField");
            bdl.DataMember = null;
            Assert.AreEqual(String.Empty, bdl.DataMember, "-DataMember");
            bdl.DataSource = null;
            Assert.IsNull(bdl.DataSource, "-DataSource");
            bdl.UseAccessibleHeader = false;
            Assert.IsFalse(bdl.UseAccessibleHeader, "-UseAccessibleHeader");

            Assert.AreEqual(0, bdl.Attributes.Count, "Attributes.Count-2");
            // CaptionAlign and UseAccessibleHeader aren't removed
            Assert.AreEqual(2, bdl.StateBag.Count, "ViewState.Count-2");
        }
Beispiel #28
0
		public void OnDataSourceViewChanged ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.IsFalse (bdl.RequiresDataBind, "RequiresDataBind-1");
			bdl.BaseOnDataSourceViewChanged (this, EventArgs.Empty);
			Assert.IsTrue (bdl.RequiresDataBind, "RequiresDataBind-2");
		}
Beispiel #29
0
		public void NullProperties ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (0, bdl.Attributes.Count, "Attributes.Count-1");
			Assert.AreEqual (0, bdl.StateBag.Count, "ViewState.Count-1");

			bdl.Caption = null;
			Assert.AreEqual (String.Empty, bdl.Caption, "Caption");
			bdl.CaptionAlign = TableCaptionAlign.NotSet;
			Assert.AreEqual (TableCaptionAlign.NotSet, bdl.CaptionAlign, "CaptionAlign");
			Assert.AreEqual (1, bdl.StateBag.Count, "ViewState.Count-2");

			// many properties can't be set without causing a InvalidCastException

			bdl.DataKeyField = null;
			Assert.AreEqual (String.Empty, bdl.DataKeyField, "DataKeyField");
			bdl.DataMember = null;
			Assert.AreEqual (String.Empty, bdl.DataMember, "DataMember");
			bdl.DataSource = null;
			Assert.IsNull (bdl.DataSource, "DataSource");
			bdl.UseAccessibleHeader = false;
			Assert.IsFalse (bdl.UseAccessibleHeader, "UseAccessibleHeader");
#if NET_2_0
			bdl.DataSourceID = String.Empty;
			Assert.AreEqual (String.Empty, bdl.DataSourceID, "DataSourceID");
			Assert.AreEqual (3, bdl.StateBag.Count, "ViewState.Count-3");
#else
			Assert.AreEqual (2, bdl.StateBag.Count, "ViewState.Count-3");
#endif
			Assert.AreEqual (0, bdl.Attributes.Count, "Attributes.Count-2");
		}
Beispiel #30
0
		public void GetData_WithUnexistingDataSourceID ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.Page = new Page ();
			bdl.DataSourceID = "mono";
			bdl.Data ();
		}
Beispiel #31
0
		public void OnDataPropertyChanged ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.DataPropertyChangedCalled = false;
			bdl.DataMember = String.Empty;
			Assert.IsTrue (bdl.DataPropertyChangedCalled, "OnDataPropertyChanged-DataMember");
			Assert.IsFalse (bdl.IsInitialized, "Initialized-DataMember");

			bdl.DataPropertyChangedCalled = false;
			bdl.DataSource = null;
			Assert.IsTrue (bdl.DataPropertyChangedCalled, "OnDataPropertyChanged-DataSource");
			Assert.IsFalse (bdl.IsInitialized, "Initialized-DataSource");

			bdl.DataPropertyChangedCalled = false;
			bdl.DataSourceID = String.Empty;
			Assert.IsTrue (bdl.DataPropertyChangedCalled, "OnDataPropertyChanged-DataSourceID");
			Assert.IsFalse (bdl.IsInitialized, "Initialized-DataSourceID");
		}
Beispiel #32
0
		public void EnsureDataBound_WithoutDataSourceID ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.IsFalse (bdl.DataBindingCalled, "Before EnsureDataBound");
			bdl.Ensure ();
			Assert.IsFalse (bdl.DataBindingCalled, "After EnsureDataBound");
		}
Beispiel #33
0
		public void GetData ()
		{
			Test2DataSource ds = new Test2DataSource ();
			ds.ID = "mono";
			TestBaseDataList bdl = new TestBaseDataList ();
			Page p = new Page ();
			bdl.Page = p;
			ds.Page = p;
			p.Controls.Add (ds);
			p.Controls.Add (bdl);
			bdl.DataSourceID = "mono";
			Assert.IsNotNull (bdl.Data (), "GetData");
		}
Beispiel #34
0
		public void Render ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.DataSource = GetDataSource (3);
			bdl.DataBind ();
			Assert.AreEqual (String.Empty, bdl.Render ());
		}
Beispiel #35
0
		public void OnDataBinding ()
		{
			// does DataBind calls base.OnDataBinding (like most sample do)
			// or does it call the overriden OnDataBinding (which seems logical)
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.IsFalse (bdl.DataBindingCalled, "Before DataBind");
			bdl.DataSource = GetDataSource (3);
			bdl.DataBind ();
			Assert.IsTrue (bdl.DataBindingCalled, "After DataBind");
		}
Beispiel #36
0
		public void AddParsedSubObject ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.Add (null);
			bdl.Add (new LiteralControl ("mono"));
			bdl.Add (new DataListItem (0, ListItemType.Item));
			bdl.Add (String.Empty);
			bdl.Add (new Control ());
			Assert.AreEqual (0, bdl.Controls.Count, "Controls");
			Assert.AreEqual (0, bdl.StateBag.Count, "StateBag");
		}
Beispiel #37
0
		public void GridLines_InvalidCastException ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (GridLines.Both, bdl.GridLines, "GridLines");
			bdl.GridLines = GridLines.Both;
		}
Beispiel #38
0
		public void OnLoad_WithDataSource ()
		{
			XmlDataSource ds = new XmlDataSource ();
			ds.ID = "mono";
			TestBaseDataList bdl = new TestBaseDataList ();
			Page p = new Page ();
			bdl.Page = p;
			p.Controls.Add (ds);
			p.Controls.Add (bdl);
			bdl.DataSourceID = "mono";
			Assert.IsTrue (bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID");
			Assert.IsTrue (bdl.EnableViewState, "EnabledViewState");
			Assert.IsFalse (bdl.Page.IsPostBack, "IsPostBack");
			bdl.BaseOnLoad (EventArgs.Empty);
			Assert.IsTrue (bdl.IsInitialized, "IsInitialized");
			Assert.IsTrue (bdl.RequiresDataBind, "RequiresDataBind");
		}
Beispiel #39
0
        public void Render_Empty()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(String.Empty, bdl.Render());
        }
Beispiel #40
0
        public void DataSource_Other()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.DataSource = new object();
        }
Beispiel #41
0
		public void HorizontalAlign_InvalidCastException ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (HorizontalAlign.NotSet, bdl.HorizontalAlign, "HorizontalAlign");
			bdl.HorizontalAlign = HorizontalAlign.NotSet;
		}
Beispiel #42
0
		public void CleanProperties ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();

			bdl.Caption = "Mono";
			Assert.AreEqual ("Mono", bdl.Caption, "Caption");
			bdl.CaptionAlign = TableCaptionAlign.Top;
			Assert.AreEqual (TableCaptionAlign.Top, bdl.CaptionAlign, "CaptionAlign");
			// many properties can't be set without causing a InvalidCastException
			bdl.DataKeyField = "key";
			Assert.AreEqual ("key", bdl.DataKeyField, "DataKeyField");
			bdl.DataMember = "member";
			Assert.AreEqual ("member", bdl.DataMember, "DataMember");
			bdl.DataSource = GetData (2);
			Assert.IsNotNull (bdl.DataSource, "DataSource");
			bdl.UseAccessibleHeader = true;
			Assert.IsTrue (bdl.UseAccessibleHeader, "UseAccessibleHeader");

			Assert.AreEqual (0, bdl.Attributes.Count, "Attributes.Count-1");
			Assert.AreEqual (5, bdl.StateBag.Count, "ViewState.Count-1");

			bdl.Caption = null;
			Assert.AreEqual (String.Empty, bdl.Caption, "-Caption");
			bdl.CaptionAlign = TableCaptionAlign.NotSet;
			Assert.AreEqual (TableCaptionAlign.NotSet, bdl.CaptionAlign, "-CaptionAlign");
			// many properties can't be set without causing a InvalidCastException
			bdl.DataKeyField = null;
			Assert.AreEqual (String.Empty, bdl.DataKeyField, "-DataKeyField");
			bdl.DataMember = null;
			Assert.AreEqual (String.Empty, bdl.DataMember, "-DataMember");
			bdl.DataSource = null;
			Assert.IsNull (bdl.DataSource, "-DataSource");
			bdl.UseAccessibleHeader = false;
			Assert.IsFalse (bdl.UseAccessibleHeader, "-UseAccessibleHeader");

			Assert.AreEqual (0, bdl.Attributes.Count, "Attributes.Count-2");
			// CaptionAlign and UseAccessibleHeader aren't removed
			Assert.AreEqual (2, bdl.StateBag.Count, "ViewState.Count-2");
		}
Beispiel #43
0
		public void Render_Empty ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (String.Empty, bdl.Render ());
		}
Beispiel #44
0
		public void TableCaption ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			foreach (TableCaptionAlign tca in Enum.GetValues (typeof (TableCaptionAlign))) {
				bdl.CaptionAlign = tca;
			}
		}
Beispiel #45
0
		public void Events ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			selectedIndexChangedEvent = false;
			bdl.SelectedIndexChanged += new EventHandler (SelectedIndexChangedHandler);
			bdl.DoSelectedIndexChanged (new EventArgs ());
			Assert.IsTrue (selectedIndexChangedEvent, "selectedIndexChangedEvent");
		}
Beispiel #46
0
		public void TableCaption_Int32MaxValue ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.CaptionAlign = (TableCaptionAlign)Int32.MaxValue;
		}
Beispiel #47
0
		public void DataSourceID ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.IsFalse (bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID-1");
			bdl.DataSourceID = "mono";
			Assert.IsTrue (bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID-2");
			bdl.DataBind ();
			Assert.IsTrue (bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID-3");
		}
Beispiel #48
0
		public void DataSource_IEnumerable ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.DataSource = GetData (2);
			Assert.IsNotNull (bdl.DataSource, "DataSource");
		}
Beispiel #49
0
		public void EnsureDataBound_WithDataSourceID ()
		{
			XmlDataSource ds = new XmlDataSource ();
			ds.Data = "";
			ds.ID = "mono";
			TestBaseDataList bdl = new TestBaseDataList ();
			Page p = new Page ();
			bdl.Page = p;
			p.Controls.Add (ds);
			p.Controls.Add (bdl);
			bdl.DataSourceID = "mono";

			Assert.IsFalse (bdl.DataBindingCalled, "Before EnsureDataBound");
			bdl.Ensure ();
			Assert.IsFalse (bdl.DataBindingCalled, "After EnsureDataBound");

			bdl.BaseOnLoad (EventArgs.Empty);
			bdl.Ensure ();
			Assert.IsTrue (bdl.DataBindingCalled, "After BaseOnLoad|RequiresDataBinding");
		}
Beispiel #50
0
		public void DataSource_IListSource ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.DataSource = GetDataSource (3);
			Assert.IsNotNull (bdl.DataSource, "DataSource");
		}
Beispiel #51
0
		public void GetData_WithoutDataSourceID ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.IsNull (bdl.Data (), "GetData");
		}
Beispiel #52
0
		public void DataSource_Other ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.DataSource = new object ();
		}
Beispiel #53
0
		public void OnDataBinding_False ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.IsFalse (bdl.DataBindingCalled, "Before DataBind");
			bdl.DataSource = GetDataSource (3);
			bdl.DataBindBool (false);
			Assert.IsFalse (bdl.DataBindingCalled, "After DataBind");
		}
Beispiel #54
0
		public void CellPadding_InvalidCastException ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (-1, bdl.CellPadding, "CellPadding");
			bdl.CellPadding = -1;
		}
Beispiel #55
0
		public void OnInit ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.IsFalse (bdl.IsInitialized, "Initialized-1");
			bdl.BaseOnInit (EventArgs.Empty);
			Assert.IsFalse (bdl.IsInitialized, "Initialized-2");
			// OnInit doesn't set Initialized to true
		}
Beispiel #56
0
		public void CellSpacing_InvalidCastException ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (0, bdl.CellSpacing, "CellSpacing");
			bdl.CellSpacing = 0;
		}
Beispiel #57
0
		public void OnLoad_WithPageWithoutViewState ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Page p = new Page ();
			bdl.Page = p;
			bdl.EnableViewState = false;
			Assert.IsFalse (bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID");
			Assert.IsFalse (bdl.EnableViewState, "EnabledViewState");
			Assert.IsFalse (bdl.Page.IsPostBack, "IsPostBack");
			bdl.BaseOnLoad (EventArgs.Empty);
			Assert.IsTrue (bdl.IsInitialized, "IsInitialized");
			Assert.IsTrue (bdl.RequiresDataBind, "RequiresDataBind");
		}
Beispiel #58
0
        public void GetData_WithoutDataSourceID()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.IsNull(bdl.Data(), "GetData");
        }
Beispiel #59
0
		public void SupportsDisabledAttribute ()
		{
			var ver40 = new Version (4, 0);
			var ver35 = new Version (3, 5);
			var p = new TestBaseDataList ();
			Assert.AreEqual (ver40, p.RenderingCompatibility, "#A1-1");
			Assert.IsFalse (p.SupportsDisabledAttribute, "#A1-2");

			p.RenderingCompatibility = new Version (3, 5);
			Assert.AreEqual (ver35, p.RenderingCompatibility, "#A2-1");
			Assert.IsTrue (p.SupportsDisabledAttribute, "#A2-2");
		}
Beispiel #60
0
		public void DefaultProperties ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual ("span", bdl.Tag, "TagName");

			Assert.AreEqual (0, bdl.Attributes.Count, "Attributes.Count-1");
			Assert.AreEqual (0, bdl.StateBag.Count, "ViewState.Count-1");
			
			Assert.AreEqual (String.Empty, bdl.Caption, "Caption");
			Assert.AreEqual (TableCaptionAlign.NotSet, bdl.CaptionAlign, "CaptionAlign");
			Assert.AreEqual (-1, bdl.CellPadding, "CellPadding");
			Assert.AreEqual (0, bdl.CellSpacing, "CellSpacing");
			Assert.AreEqual (0, bdl.Controls.Count, "Controls.Count");
			Assert.AreEqual (String.Empty, bdl.DataKeyField, "DataKeyField");
			Assert.AreEqual (String.Empty, bdl.DataMember, "DataMember");
			Assert.IsNull (bdl.DataSource, "DataSource");
			Assert.AreEqual (GridLines.Both, bdl.GridLines, "GridLines");
			Assert.AreEqual (HorizontalAlign.NotSet, bdl.HorizontalAlign, "HorizontalAlign");
			Assert.IsFalse (bdl.UseAccessibleHeader, "UseAccessibleHeader");
#if NET_2_0
			Assert.AreEqual (String.Empty, bdl.DataSourceID, "DataSourceID");
#endif
			Assert.AreEqual (0, bdl.Attributes.Count, "Attributes.Count-2");
			Assert.AreEqual (0, bdl.StateBag.Count, "ViewState.Count-2");

			Assert.AreEqual (0, bdl.DataKeys.Count, "DataKeys.Count");
			Assert.AreEqual (0, bdl.Attributes.Count, "Attributes.Count-3");
			// triggered by DataKeys, which makes DataKeysArray store its value.
			Assert.AreEqual (1, bdl.StateBag.Count, "ViewState.Count-3");
			Assert.AreEqual (typeof (ArrayList), bdl.StateBag ["DataKeys"].GetType (), "ViewState.Value-1");
		}