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 [Category ("NotWorking")]
85 public void Content_DefaultProperty ()
87 PokerContent pc = new PokerContent();
88 Assert.AreEqual (String.Empty, pc.ContentPlaceHolderID, "ContentPlaceHolderID");
91 private bool OnDataBinding;
94 private bool OnPreRender;
95 private bool OnUnLoad;
97 private void OnUnLoadHendler (Object sender, EventArgs args)
102 private void OnPreRenderHendler (Object sender, EventArgs args)
107 private void OnLoadHandler (Object sender, EventArgs args)
112 private void OnDataBindingHandler (Object sender, EventArgs args)
114 OnDataBinding = true;
116 private void OnInitHandler (Object sender, EventArgs args)
122 [Category ("NotWorking")]
123 public void Events ()
125 PokerContent pc = new PokerContent ();
126 pc.DataBinding += new EventHandler (OnDataBindingHandler);
127 pc.Init += new EventHandler (OnInitHandler);
128 pc.Load += new EventHandler (OnLoadHandler);
129 pc.PreRender += new EventHandler (OnPreRenderHendler);
130 pc.Unload += new EventHandler (OnUnLoadHendler);
132 Assert.AreEqual (false, OnUnLoad, "BeforeUnLoad");
134 Assert.AreEqual (true, OnUnLoad, "AfterUnLoad");
136 Assert.AreEqual (false, OnPreRender, "BeforePreRender");
138 Assert.AreEqual (true, OnPreRender, "AfterPreRender");
140 Assert.AreEqual (false, OnLoad, "BeforeLoad");
142 Assert.AreEqual (true, OnLoad, "AfterLoad");
144 Assert.AreEqual (false, OnInit, "BeforeInit");
146 Assert.AreEqual (true, OnInit, "AfterInit");
148 Assert.AreEqual (false, OnDataBinding, "BeforeDataBinding");
149 pc.DoOnDataBinding ();
150 Assert.AreEqual (true, OnDataBinding, "AfterDataBinding");
154 [Category ("NotWorking")]
155 [ExpectedException (typeof(NotSupportedException))]
156 public void Content_PropertyExeption ()
158 PokerContent pc = new PokerContent ();
159 pc.ContentPlaceHolderID = "fake";