Inheritance: ITemplate
コード例 #1
0
ファイル: MasterPageTest.cs プロジェクト: nobled/mono
		public static void InstantiateInContentPlaceHolder_WithPage_Load (Page p)
		{
			MasterPage mp = p.Master;
			Assert.IsNotNull (mp, "#A0");

			ITemplate template = new MyTemplate ();

			AssertExtensions.Throws<NullReferenceException> (() => {
				mp.InstantiateInContentPlaceHolder (null, template);
			}, "#A1-1");

			Control container = new Control ();
			AssertExtensions.Throws<NullReferenceException> (() => {
				mp.InstantiateInContentPlaceHolder (container, null);
			}, "#A1-2");

			mp.InstantiateInContentPlaceHolder (container, template);
			Assert.IsTrue (HasLiteralWithText (container, MyTemplate.MyText), "#B1-1");

			template = new MyContentTemplate ();
			mp.InstantiateInContentPlaceHolder (container, template);
			Assert.IsTrue (HasLiteralWithText (container, MyContentTemplate.MyText), "#B1-2");
		}
コード例 #2
0
		public void FormView_AssignToDefaultProperties ()
		{
			Poker p = new Poker ();
			MyTemplate customTemplate = new MyTemplate ();
			TableItemStyle tableStyle = new TableItemStyle ();			
			p.AllowPaging = true;
			Assert.AreEqual (true, p.AllowPaging, "A40");
			p.BackImageUrl = "image.jpg";
			Assert.AreEqual ("image.jpg", p.BackImageUrl, "A41");
			// ToDo: p.BottomPagerRow
			p.Caption = "Employee Details";
			Assert.AreEqual ("Employee Details", p.Caption, "A42");
			p.CaptionAlign = TableCaptionAlign.Bottom;
			Assert.AreEqual (TableCaptionAlign.Bottom, p.CaptionAlign, "A43");
			p.CaptionAlign = TableCaptionAlign.Left;
			Assert.AreEqual (TableCaptionAlign.Left, p.CaptionAlign, "A44");
			p.CaptionAlign = TableCaptionAlign.NotSet;
			Assert.AreEqual (TableCaptionAlign.NotSet, p.CaptionAlign, "A45");
			p.CaptionAlign = TableCaptionAlign.Right;
			Assert.AreEqual (TableCaptionAlign.Right, p.CaptionAlign, "A46");
			p.CaptionAlign = TableCaptionAlign.Top;
			Assert.AreEqual (TableCaptionAlign.Top, p.CaptionAlign, "A47");
			p.CellPadding = 10;
			Assert.AreEqual (10, p.CellPadding, "A48");
			p.CellSpacing = 20;
			Assert.AreEqual (20, p.CellSpacing, "A49");			
			Assert.AreEqual (FormViewMode.ReadOnly, p.CurrentMode, "A52");			
			p.DefaultMode = FormViewMode.Edit;
			Assert.AreEqual (FormViewMode.Edit, p.DefaultMode, "A53");
			p.DefaultMode = FormViewMode.Insert;
			Assert.AreEqual (FormViewMode.Insert, p.DefaultMode, "A54");
			p.DefaultMode = FormViewMode.ReadOnly;
			Assert.AreEqual (FormViewMode.ReadOnly, p.DefaultMode, "A55");
			p.EditRowStyle.BackColor = Color.Red;
			Assert.AreEqual (Color.Red, p.EditRowStyle.BackColor, "A56");			
			p.EmptyDataRowStyle.ForeColor = Color.Purple;
			Assert.AreEqual (Color.Purple, p.EmptyDataRowStyle.ForeColor, "A57");
			p.EmptyDataTemplate = customTemplate;
			Assert.AreEqual (customTemplate, p.EmptyDataTemplate, "A58");
			p.EmptyDataText = "No data";
			Assert.AreEqual ("No data", p.EmptyDataText, "A59");
			p.EditItemTemplate = customTemplate;
			Assert.AreEqual (customTemplate, p.EditItemTemplate, "A60");
			p.FooterTemplate = customTemplate;
			Assert.AreEqual (customTemplate, p.FooterTemplate, "A61");
			p.FooterText = "Test Footer";
			Assert.AreEqual ("Test Footer", p.FooterText, "A62");
			p.FooterStyle.BorderStyle = BorderStyle.Double;
			Assert.AreEqual (BorderStyle.Double, p.FooterStyle.BorderStyle, "A63");
			p.GridLines = GridLines.Both;
			Assert.AreEqual (GridLines.Both, p.GridLines, "A64");
			p.GridLines = GridLines.Horizontal;
			Assert.AreEqual (GridLines.Horizontal, p.GridLines, "A65");
			p.GridLines = GridLines.None;
			Assert.AreEqual (GridLines.None, p.GridLines, "A66");
			p.GridLines = GridLines.Vertical;
			Assert.AreEqual (GridLines.Vertical, p.GridLines, "A67");
			p.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
			Assert.AreEqual (HorizontalAlign.Left, p.HeaderStyle.HorizontalAlign, "A68");
			p.HeaderTemplate = customTemplate;
			Assert.AreEqual (customTemplate, p.HeaderTemplate, "A69");
			p.HeaderText = "Test Header";
			Assert.AreEqual ("Test Header", p.HeaderText, "A70");
			p.HorizontalAlign = HorizontalAlign.Center;
			Assert.AreEqual (HorizontalAlign.Center, p.HorizontalAlign, "A71");
			p.HorizontalAlign = HorizontalAlign.Justify;
			Assert.AreEqual (HorizontalAlign.Justify, p.HorizontalAlign, "A72");
			p.HorizontalAlign = HorizontalAlign.Left;
			Assert.AreEqual (HorizontalAlign.Left, p.HorizontalAlign, "A73");
			p.HorizontalAlign = HorizontalAlign.NotSet;
			Assert.AreEqual (HorizontalAlign.NotSet, p.HorizontalAlign, "A74");
			p.HorizontalAlign = HorizontalAlign.Right;
			Assert.AreEqual (HorizontalAlign.Right, p.HorizontalAlign, "A75");
			p.InsertItemTemplate = customTemplate;
			Assert.AreEqual (customTemplate, p.InsertItemTemplate, "A76");
			p.InsertRowStyle.BorderStyle = BorderStyle.Outset;
			Assert.AreEqual (BorderStyle.Outset, p.InsertRowStyle.BorderStyle, "A77");
			p.ItemTemplate = customTemplate;
			Assert.AreEqual (customTemplate, p.ItemTemplate, "A78");
			p.PagerSettings.FirstPageText = "PagerSettings Test";
			Assert.AreEqual ("PagerSettings Test", p.PagerSettings.FirstPageText, "A79");
			p.PagerStyle.BorderStyle = BorderStyle.Groove;
			Assert.AreEqual (BorderStyle.Groove, p.PagerStyle.BorderStyle, "A80");
			p.PagerTemplate = customTemplate;
			Assert.AreEqual (customTemplate, p.PagerTemplate, "A81");
			p.RowStyle.ForeColor = Color.Plum;
			Assert.AreEqual (Color.Plum, p.RowStyle.ForeColor, "A82");
		}
コード例 #3
0
ファイル: MasterPageTest.cs プロジェクト: nobled/mono
		public void InstantiateInContentPlaceHolder ()
		{
			var mp = new MasterPage ();
			ITemplate template = new MyTemplate ();

			AssertExtensions.Throws<NullReferenceException> (() => {
				mp.InstantiateInContentPlaceHolder (null, template);
			}, "#A1-1");

			Control container = new Control ();
			AssertExtensions.Throws<NullReferenceException> (() => {
				mp.InstantiateInContentPlaceHolder (container, null);
			}, "#A1-2");
#if DOTNET
			// TODO: why does it throw? Unchecked 'as' type cast?
			AssertExtensions.Throws<NullReferenceException> (() => {
				mp.InstantiateInContentPlaceHolder (container, template);
			}, "#B1-1");
#endif
			// TODO: Still throws a NREX, probably needs a full web request context, as it works below in the
			// InstantiateInContentPlaceHolder_WithPage test
			//
			//template = new MyContentTemplate ();
			//mp.InstantiateInContentPlaceHolder (container, template);
		}