Пример #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");
        }
Пример #2
0
        public void HorizontalAlign_InvalidCastException()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(HorizontalAlign.NotSet, bdl.HorizontalAlign, "HorizontalAlign");
            bdl.HorizontalAlign = HorizontalAlign.NotSet;
        }
Пример #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");
        }
Пример #4
0
        public void CellSpacing_InvalidCastException()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(0, bdl.CellSpacing, "CellSpacing");
            bdl.CellSpacing = 0;
        }
Пример #5
0
        public void DataSource_IEnumerable()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.DataSource = GetData(2);
            Assert.IsNotNull(bdl.DataSource, "DataSource");
        }
Пример #6
0
        public void GridLines_InvalidCastException()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(GridLines.Both, bdl.GridLines, "GridLines");
            bdl.GridLines = GridLines.Both;
        }
Пример #7
0
        public void CellPadding_InvalidCastException()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(-1, bdl.CellPadding, "CellPadding");
            bdl.CellPadding = -1;
        }
Пример #8
0
        public void DataSource_IListSource()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.DataSource = GetDataSource(3);
            Assert.IsNotNull(bdl.DataSource, "DataSource");
        }
Пример #9
0
        public void Render()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.DataSource = GetDataSource(3);
            bdl.DataBind();
            Assert.AreEqual(String.Empty, bdl.Render());
        }
Пример #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");
        }
Пример #11
0
        public void GetData_WithUnexistingDataSourceID()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.Page         = new Page();
            bdl.DataSourceID = "mono";
            bdl.Data();
        }
Пример #12
0
        public void EnsureDataBound_WithoutDataSourceID()
        {
            TestBaseDataList bdl = new TestBaseDataList();

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

            selectedIndexChangedEvent = false;
            bdl.SelectedIndexChanged += new EventHandler(SelectedIndexChangedHandler);
            bdl.DoSelectedIndexChanged(new EventArgs());
            Assert.IsTrue(selectedIndexChangedEvent, "selectedIndexChangedEvent");
        }
Пример #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");
        }
Пример #15
0
        public void TableCaption()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            foreach (TableCaptionAlign tca in Enum.GetValues(typeof(TableCaptionAlign)))
            {
                bdl.CaptionAlign = tca;
            }
        }
Пример #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
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
		}
Пример #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");
		}
Пример #30
0
		public void GetData_WithUnexistingDataSourceID ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.Page = new Page ();
			bdl.DataSourceID = "mono";
			bdl.Data ();
		}
Пример #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");
		}
Пример #32
0
		public void EnsureDataBound_WithoutDataSourceID ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.IsFalse (bdl.DataBindingCalled, "Before EnsureDataBound");
			bdl.Ensure ();
			Assert.IsFalse (bdl.DataBindingCalled, "After EnsureDataBound");
		}
Пример #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");
		}
Пример #34
0
		public void Render ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.DataSource = GetDataSource (3);
			bdl.DataBind ();
			Assert.AreEqual (String.Empty, bdl.Render ());
		}
Пример #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");
		}
Пример #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");
		}
Пример #37
0
		public void GridLines_InvalidCastException ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (GridLines.Both, bdl.GridLines, "GridLines");
			bdl.GridLines = GridLines.Both;
		}
Пример #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");
		}
Пример #39
0
        public void Render_Empty()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.AreEqual(String.Empty, bdl.Render());
        }
Пример #40
0
        public void DataSource_Other()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            bdl.DataSource = new object();
        }
Пример #41
0
		public void HorizontalAlign_InvalidCastException ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (HorizontalAlign.NotSet, bdl.HorizontalAlign, "HorizontalAlign");
			bdl.HorizontalAlign = HorizontalAlign.NotSet;
		}
Пример #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");
		}
Пример #43
0
		public void Render_Empty ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (String.Empty, bdl.Render ());
		}
Пример #44
0
		public void TableCaption ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			foreach (TableCaptionAlign tca in Enum.GetValues (typeof (TableCaptionAlign))) {
				bdl.CaptionAlign = tca;
			}
		}
Пример #45
0
		public void Events ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			selectedIndexChangedEvent = false;
			bdl.SelectedIndexChanged += new EventHandler (SelectedIndexChangedHandler);
			bdl.DoSelectedIndexChanged (new EventArgs ());
			Assert.IsTrue (selectedIndexChangedEvent, "selectedIndexChangedEvent");
		}
Пример #46
0
		public void TableCaption_Int32MaxValue ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.CaptionAlign = (TableCaptionAlign)Int32.MaxValue;
		}
Пример #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");
		}
Пример #48
0
		public void DataSource_IEnumerable ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.DataSource = GetData (2);
			Assert.IsNotNull (bdl.DataSource, "DataSource");
		}
Пример #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");
		}
Пример #50
0
		public void DataSource_IListSource ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.DataSource = GetDataSource (3);
			Assert.IsNotNull (bdl.DataSource, "DataSource");
		}
Пример #51
0
		public void GetData_WithoutDataSourceID ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.IsNull (bdl.Data (), "GetData");
		}
Пример #52
0
		public void DataSource_Other ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			bdl.DataSource = new object ();
		}
Пример #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");
		}
Пример #54
0
		public void CellPadding_InvalidCastException ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (-1, bdl.CellPadding, "CellPadding");
			bdl.CellPadding = -1;
		}
Пример #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
		}
Пример #56
0
		public void CellSpacing_InvalidCastException ()
		{
			TestBaseDataList bdl = new TestBaseDataList ();
			Assert.AreEqual (0, bdl.CellSpacing, "CellSpacing");
			bdl.CellSpacing = 0;
		}
Пример #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");
		}
Пример #58
0
        public void GetData_WithoutDataSourceID()
        {
            TestBaseDataList bdl = new TestBaseDataList();

            Assert.IsNull(bdl.Data(), "GetData");
        }
Пример #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");
		}
Пример #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");
		}