New test.
[mono.git] / mcs / class / System.Web / Test / System.Web.UI.WebControls.WebParts / WebPartTest.cs
1 //
2 // Tests for System.Web.UI.WebControls.WebParts.PartTest
3 //
4 // Author:
5 //      Chris Toshok (toshok@novell.com)
6 //
7
8 //
9 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 #if NET_2_0
32
33 using System;
34 using NUnit.Framework;
35 using System.Web.UI.WebControls;
36 using System.Web.UI.WebControls.WebParts;
37
38 namespace MonoTests.System.Web.UI.WebControls.WebParts {
39
40   [TestFixture]
41   public class WebPartTest {
42         class Poker : WebPart {
43                 public void TrackState ()
44                 {
45                         TrackViewState();
46                 }
47
48                 public object SaveState ()
49                 {
50                         return SaveViewState();
51                 }
52
53                 public void LoadState (object o)
54                 {
55                         LoadViewState(o);
56                 }
57         }
58
59         [Test]
60         public void Defaults ()
61         {
62                 Poker p = new Poker ();
63
64                 Assert.AreEqual (p.AllowClose, true, "A1");
65                 Assert.AreEqual (p.AllowConnect, true, "A2");
66                 Assert.AreEqual (p.AllowEdit, true, "A3");
67                 Assert.AreEqual (p.AllowHide, true, "A4");
68                 Assert.AreEqual (p.AllowMinimize, true, "A5");
69                 Assert.AreEqual (p.AllowZoneChange, true, "A6");
70                 Assert.AreEqual (p.AuthorizationFilter, String.Empty, "A7");
71                 Assert.AreEqual (p.CatalogIconImageUrl, String.Empty, "A8");
72                 Assert.AreEqual (p.ChromeState, PartChromeState.Normal, "A9");
73                 Assert.AreEqual (p.ChromeType, PartChromeType.Default, "A10");
74                 Assert.AreEqual (p.ConnectErrorMessage, String.Empty, "A11");
75                 Assert.AreEqual (p.Description, String.Empty, "A12");
76                 /* Direction - A13 */
77                 Assert.AreEqual (p.DisplayTitle, "Untitled", "A14");
78                 Assert.AreEqual (p.ExportMode, WebPartExportMode.None, "A15");
79                 Assert.AreEqual (p.HasSharedData, false, "A16");
80                 Assert.AreEqual (p.HasUserData, false, "A17");
81                 Assert.AreEqual (p.Height, Unit.Empty, "A18");
82                 Assert.AreEqual (p.HelpMode, WebPartHelpMode.Navigate, "A19");
83                 Assert.AreEqual (p.HelpUrl, String.Empty, "A20");
84                 Assert.AreEqual (p.Hidden, false, "A21");
85                 Assert.AreEqual (p.ImportErrorMessage, "Cannot import this Web Part.", "A22");
86                 Assert.AreEqual (p.IsClosed, false, "A23");
87                 Assert.AreEqual (p.IsShared, false, "A24");
88                 Assert.AreEqual (p.IsStandalone, true, "A25");
89                 /* this next isn't really a default - it's true
90                  * because the part was created programmatically */
91                 Assert.AreEqual (p.IsStatic, true, "A26"); 
92                 Assert.AreEqual (p.Subtitle, String.Empty, "A27");
93                 Assert.AreEqual (p.Title, String.Empty, "A28");
94                 Assert.AreEqual (p.TitleIconImageUrl, String.Empty, "A29");
95                 Assert.AreEqual (p.TitleUrl, String.Empty, "A30");
96                 Assert.IsNotNull (p.Verbs, "A31");
97 #if IWebEditableInterface
98                 Assert.AreEqual (p.WebBrowsableObject, null, "A32");
99 #endif
100 #if notyet
101                 Assert.AreEqual (p.WebPartManager, null, "A33");
102 #endif          
103                 Assert.AreEqual (p.Width, Unit.Empty, "A34");
104                 Assert.AreEqual (p.ZoneIndex, 0, "A35");
105         }
106   }
107 }
108
109 #endif