* support-test-*.cs: Rename from test-*-p2.cs.
[mono.git] / mcs / class / System.Web / Test / System.Web.UI.WebControls / FormViewTest.cs
1 //
2 // Tests for System.Web.UI.WebControls.FormView.cs 
3 //
4 // Author:
5 //      Chris Toshok (toshok@ximian.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 using NUnit.Framework;
33 using System;
34 using System.IO;
35 using System.Globalization;
36 using System.Web;
37 using System.Web.UI;
38 using System.Web.UI.WebControls;
39
40 namespace MonoTests.System.Web.UI.WebControls
41 {
42         [TestFixture]   
43         public class FormViewTest {     
44                 class Poker : FormView {
45                         public Poker () {
46                                 TrackViewState ();
47                         }
48
49                         public object SaveState () {
50                                 return SaveViewState ();
51                         }
52
53                         public void LoadState (object state) {
54                                 LoadViewState (state);
55                         }
56                 }
57                 
58                 [Test]
59                 public void Defaults ()
60                 {
61                         Poker p = new Poker ();
62
63                         Assert.IsFalse (p.AllowPaging, "A1");
64                         Assert.AreEqual ("", p.BackImageUrl, "A2");
65                         Assert.IsNull (p.BottomPagerRow, "A3");
66                         Assert.AreEqual ("", p.Caption, "A4");
67                         Assert.AreEqual (TableCaptionAlign.NotSet, p.CaptionAlign ,"A5");
68                         Assert.AreEqual (-1, p.CellPadding, "A6");
69                         Assert.AreEqual (0, p.CellSpacing, "A7");
70                         Assert.AreEqual (FormViewMode.ReadOnly, p.CurrentMode, "A8");
71                         Assert.AreEqual (FormViewMode.ReadOnly, p.DefaultMode, "A9");
72                         Assert.IsNotNull (p.DataKeyNames, "A10");
73                         Assert.AreEqual (0, p.DataKeyNames.Length, "A10.1");
74                         Assert.IsNotNull (p.DataKey, "A11");
75                         Assert.AreEqual (0, p.DataKey.Values.Count, "A11.1");
76                         Assert.IsNull (p.EditItemTemplate, "A12");
77                         Assert.IsNotNull (p.EditRowStyle, "A13");
78
79                         Assert.IsNotNull (p.EmptyDataRowStyle, "A14");
80
81                         Assert.IsNull (p.EmptyDataTemplate, "A15");
82                         Assert.AreEqual ("", p.EmptyDataText, "A16");
83                         Assert.IsNull (p.FooterRow, "A17");
84                         Assert.IsNull (p.FooterTemplate, "A18");
85                         Assert.AreEqual ("", p.FooterText, "A19");
86                         Assert.IsNotNull (p.FooterStyle, "A20");
87
88                         Assert.AreEqual (GridLines.None, p.GridLines, "A21");
89                         Assert.IsNull (p.HeaderRow, "A22");
90                         Assert.IsNotNull (p.HeaderStyle, "A23");
91
92                         Assert.IsNull (p.HeaderTemplate, "A24");
93                         Assert.AreEqual ("", p.HeaderText, "A25");
94                         Assert.AreEqual (HorizontalAlign.NotSet, p.HorizontalAlign, "A26");
95                         Assert.IsNull (p.InsertItemTemplate, "A27");
96                         Assert.IsNotNull (p.InsertRowStyle, "A28");
97
98                         Assert.IsNull (p.ItemTemplate, "A29");
99                         Assert.AreEqual (0, p.PageCount, "A30");
100                         Assert.AreEqual (0, p.PageIndex, "A31");
101                         Assert.IsNull (p.PagerTemplate, "A32");
102                         Assert.IsNull (p.Row, "A33");
103                         Assert.IsNotNull (p.RowStyle, "A34");
104
105                         Assert.IsNull (p.SelectedValue, "A35");
106                         Assert.IsNull (p.TopPagerRow, "A36");
107                         Assert.IsNull (p.DataItem, "A37");
108                         Assert.AreEqual (0, p.DataItemCount, "A38");
109                         Assert.AreEqual (0, p.DataItemIndex, "A39");
110                 }
111         }
112 }
113 #endif