Exemple #1
0
		public void SelectedValue_SelectedIndex ()
		{
			// Test for bug https://bugzilla.novell.com/show_bug.cgi?id=376519
			DataTable table = new DataTable();
			table.Columns.Add("id");
			table.Columns.Add("text");

			table.Rows.Add(new object[] {"id1", "Item N1"});
			table.Rows.Add(new object[] {"id2", "Item N2"});
			table.Rows.Add(new object[] {"id3", "Item N3"});
			
			TestDataList dl = new TestDataList ();
			dl.DataKeyField = "id";
			dl.DataSource = table;
			dl.DataBind ();

			Assert.AreEqual (null, dl.SelectedValue, "A1");
			dl.SelectedIndex = 0;
			Assert.AreEqual ("id1", dl.SelectedValue.ToString (), "A2");
		}		
Exemple #2
0
		public void Controls ()
		{
			TestDataList dl = new TestDataList ();
			Assert.AreEqual (0, dl.Controls.Count, "Controls-1");
			Assert.AreEqual (0, dl.Items.Count, "Items-1");
			dl.DataSource = GetDataSource (3);
			Assert.AreEqual (0, dl.Controls.Count, "Controls-2");
			Assert.AreEqual (0, dl.Items.Count, "Items-2");
			dl.DataBind ();
			Assert.AreEqual (0, dl.Controls.Count, "Controls-3");
			Assert.AreEqual (0, dl.Items.Count, "Items-3");
		}
Exemple #3
0
		public void RepeatedItemCount ()
		{
			TestDataList dl = new TestDataList ();
			IRepeatInfoUser riu = (dl as IRepeatInfoUser);
			dl.DataSource = GetData (10);
			Assert.AreEqual (0, riu.RepeatedItemCount, "before Bind");
			dl.DataBind ();
			Assert.AreEqual (10, riu.RepeatedItemCount, "after Bind");
		}
Exemple #4
0
		public void GetItemStyle_Separator ()
		{
			TestDataList dl = new TestDataList ();
			dl.DataSource = GetData (6);
			dl.DataBind ();
			IRepeatInfoUser riu = (dl as IRepeatInfoUser);
			Assert.IsNull (riu.GetItemStyle (ListItemType.Separator, 0));
		}
Exemple #5
0
		public void ProperTemplateSelectedIndexEqualsEditIndex ()
		{
			TestDataList dl = new TestDataList();
			dl.ItemTemplate = new ItemTemplate();
			dl.AlternatingItemTemplate = new ItemTemplate();
			dl.SelectedItemTemplate = new ItemTemplate();
			dl.EditItemTemplate = new EditItemTemplate();
			dl.DataSource = GetData(5);
			dl.SelectedIndex = 0;
			dl.EditItemIndex = 0;
			dl.DataBind();
			object canIGetMyEditItem = dl.Items[dl.EditItemIndex].FindControl("eitemtmpl");
			Assert.IsTrue(canIGetMyEditItem != null, "ProperTemplateSelectedIndexEqualsEditIndex");
		}