2 // Tests for System.Web.UI.WebControls.ContentTest.cs
5 // Yoni Klein (yonik@mainsoft.com)
8 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using NUnit.Framework;
35 using System.Collections.Generic;
39 using System.Web.UI.WebControls;
42 using MyWebControl = System.Web.UI.WebControls;
43 using System.Collections;
44 using MonoTests.stand_alone.WebHarness;
47 namespace MonoTests.System.Web.UI.WebControls
51 class PokerContent : Content
53 public PokerContent ()
57 public void DoOnDataBinding ()
59 base.OnDataBinding(new EventArgs()) ;
61 public void DoOnInit ()
63 base.OnInit (new EventArgs ());
65 public void DoOnLoad ()
67 base.OnLoad (new EventArgs ());
69 public void DoOnPreRender ()
71 base.OnPreRender (new EventArgs ());
73 public void DoOnUnLoad ()
75 base.OnUnload (new EventArgs ());
81 public class ContentTest
84 public void Content_DefaultProperty ()
86 PokerContent pc = new PokerContent();
87 Assert.AreEqual (String.Empty, pc.ContentPlaceHolderID, "ContentPlaceHolderID");
90 private bool OnDataBinding;
93 private bool OnPreRender;
94 private bool OnUnLoad;
96 private void OnUnLoadHendler (Object sender, EventArgs args)
101 private void OnPreRenderHendler (Object sender, EventArgs args)
106 private void OnLoadHandler (Object sender, EventArgs args)
111 private void OnDataBindingHandler (Object sender, EventArgs args)
113 OnDataBinding = true;
115 private void OnInitHandler (Object sender, EventArgs args)
121 public void Events_DataBinding ()
123 PokerContent pc = new PokerContent ();
124 pc.DataBinding += new EventHandler (OnDataBindingHandler);
126 Assert.AreEqual (false, OnDataBinding, "BeforeDataBinding");
127 pc.DoOnDataBinding ();
128 Assert.AreEqual (true, OnDataBinding, "AfterDataBinding");
132 public void Events_Init ()
134 PokerContent pc = new PokerContent ();
135 pc.Init += new EventHandler (OnInitHandler);
137 Assert.AreEqual (false, OnInit, "BeforeInit");
139 Assert.AreEqual (true, OnInit, "AfterInit");
143 public void Events_PreRender ()
145 PokerContent pc = new PokerContent ();
146 pc.PreRender += new EventHandler (OnPreRenderHendler);
148 Assert.AreEqual (false, OnPreRender, "BeforePreRender");
150 Assert.AreEqual (true, OnPreRender, "AfterPreRender");
154 public void Events_Load ()
156 PokerContent pc = new PokerContent ();
157 pc.Load += new EventHandler (OnLoadHandler);
159 Assert.AreEqual (false, OnLoad, "BeforeLoad");
161 Assert.AreEqual (true, OnLoad, "AfterLoad");
165 public void Events_Unload ()
167 PokerContent pc = new PokerContent ();
168 pc.Unload += new EventHandler (OnUnLoadHendler);
170 Assert.AreEqual (false, OnUnLoad, "BeforeUnLoad");
172 Assert.AreEqual (true, OnUnLoad, "AfterUnLoad");
176 [ExpectedException (typeof(NotSupportedException))]
177 public void Content_PropertyExeption ()
179 PokerContent pc = new PokerContent ();
180 pc.ContentPlaceHolderID = "fake";