Exemplo n.º 1
0
		public void TemplateField_CreateField () {
			PokerTemplateField field = new PokerTemplateField ();
			DataControlField newfield = field.DoCreateField ();
			if (!(newfield is TemplateField)) {
				Assert.Fail ("New TemplateField was not created");
			}
		}
Exemplo n.º 2
0
		public void TemplateField_AssignProperty () {
			PokerTemplateField field = new PokerTemplateField ();
			field.AlternatingItemTemplate = new Ibutton ();
			Assert.IsNotNull (field.AlternatingItemTemplate, "AlternatingItemTemplateAssigned");
			Assert.AreEqual (typeof (Ibutton), field.AlternatingItemTemplate.GetType (), "AlternatingItemTemplateType");
			field.ConvertEmptyStringToNull = false;
			Assert.AreEqual (false, field.ConvertEmptyStringToNull, "ConvertEmptyStringToNull");
			field.EditItemTemplate = new IImage ();
			Assert.IsNotNull (field.EditItemTemplate, "EditItemTemplateAssigning");
			Assert.AreEqual (typeof (IImage), field.EditItemTemplate.GetType (), "EditItemTemplateType");
			field.FooterTemplate = new Ibutton ();
			Assert.IsNotNull (field.FooterTemplate, "FooterTemplateAssigning");
			Assert.AreEqual (typeof (Ibutton), field.FooterTemplate.GetType (), "FooterTemplateType");
			field.HeaderTemplate = new IImage ();
			Assert.IsNotNull (field.HeaderTemplate, "HeaderTemplateAssigning");
			Assert.AreEqual (typeof (IImage), field.HeaderTemplate.GetType (), "HeaderTemplateType");
			field.InsertItemTemplate = new Ibutton ();
			Assert.IsNotNull (field.InsertItemTemplate, "InsertItemTemplateAssigning");
			Assert.AreEqual (typeof (Ibutton), field.InsertItemTemplate.GetType (), "InsertItemTemplateType");
			field.ItemTemplate = new IImage ();
			Assert.IsNotNull (field.ItemTemplate, "ItemTemplateAssigning");
			Assert.AreEqual (typeof (IImage), field.ItemTemplate.GetType (), "ItemTemplateType");
		}
Exemplo n.º 3
0
		public void TemplateField_Copy () {
			PokerTemplateField field = new PokerTemplateField ();
			TemplateField copy = new TemplateField ();
			field.ConvertEmptyStringToNull = true;
			field.AlternatingItemTemplate = new Ibutton ();
			field.ItemTemplate = new Ibutton ();
			field.FooterTemplate = new Ibutton ();
			field.EditItemTemplate = new Ibutton ();
			field.HeaderTemplate = new Ibutton ();
			field.InsertItemTemplate = new Ibutton ();
			field.DoCopyProperties (copy);
			Assert.AreEqual (true, copy.ConvertEmptyStringToNull, "ConvertEmptyStringToNull");
			Assert.IsNotNull (copy.AlternatingItemTemplate, "AlternatingItemTemplate");
			Assert.IsNotNull (copy.ItemTemplate, "ItemTemplate");
			Assert.IsNotNull (copy.FooterTemplate, "FooterTemplate");
			Assert.IsNotNull (copy.EditItemTemplate, "EditItemTemplate");
			Assert.IsNotNull (copy.HeaderTemplate, "HeaderTemplate");
			Assert.IsNotNull (copy.InsertItemTemplate, "InsertItemTemplate");
		}
Exemplo n.º 4
0
		public void TemplateField_AlternatingItemTemplate () {
			PokerTemplateField field = new PokerTemplateField ();
			DataControlFieldCell cell = new DataControlFieldCell (null);
			field.ItemTemplate = new Ibutton ("test");
			field.InitializeCell (cell, DataControlCellType.DataCell, DataControlRowState.Alternate, 0);
			Assert.AreEqual ("test", ((Ibutton) cell.Controls [0]).Text, "#1");
			cell = new DataControlFieldCell (null);
			field.AlternatingItemTemplate = new Ibutton ("Alternate");
			field.InitializeCell (cell, DataControlCellType.DataCell, DataControlRowState.Alternate, 0);
			Assert.AreEqual ("Alternate", ((Ibutton) cell.Controls [0]).Text, "#2");
			cell = new DataControlFieldCell (null);
			field.InitializeCell (cell, DataControlCellType.DataCell, DataControlRowState.Insert, 0);
			Assert.AreEqual ("test", ((Ibutton) cell.Controls [0]).Text, "#3");
			cell = new DataControlFieldCell (null);
			field.ItemTemplate = null;
			field.InitializeCell (cell, DataControlCellType.DataCell, DataControlRowState.Edit, 0);
			Assert.IsTrue (cell.Controls.Count == 0, "#4");
			Assert.AreEqual (" ", cell.Text, "#5");
		}
Exemplo n.º 5
0
		public void TemplateField_HeaderTemplate () {
			PokerTemplateField field = new PokerTemplateField ();
			DataControlFieldCell cell = new DataControlFieldCell (null);
			cell.Text = "text";
			field.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Normal, 0);
			Assert.AreEqual (" ", cell.Text, "#1");
			Assert.AreEqual (0, cell.Controls.Count, "#2");
			field.HeaderTemplate = new Ibutton ("test");
			field.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Normal, 0);
			Assert.AreEqual ("", cell.Text, "#3");
			Assert.AreEqual (1, cell.Controls.Count, "#4");
			Assert.AreEqual ("test", ((Ibutton) cell.Controls [0]).Text, "#5");
		}
Exemplo n.º 6
0
		public void TemplateField_InitializeCell () {
			PokerTemplateField field = new PokerTemplateField ();
			DataControlFieldCell cell = new DataControlFieldCell (null);
			field.InitializeCell (cell, DataControlCellType.DataCell, DataControlRowState.Normal, 0);
			Assert.AreEqual (" ", cell.Text, "InitializeCellEmpty");
			field.ItemTemplate = new IImage ("test");
			field.InitializeCell (cell, DataControlCellType.DataCell, DataControlRowState.Normal, 0);
			Assert.AreEqual ("", cell.Text, "InitializeCellWithItemTemplate");
			Assert.AreEqual (1, cell.Controls.Count, "InitializeCellWithItemTemplate#1");
			Assert.AreEqual ("test", ((IImage) cell.Controls [0]).ImageUrl, "InitializeCellWithItemTemplate#2");
		}
Exemplo n.º 7
0
		public void TemplateField_InitializeCell_Null () {
			PokerTemplateField field = new PokerTemplateField ();
			field.InitializeCell (null, DataControlCellType.DataCell, DataControlRowState.Normal, 0);
		}