New test.
[mono.git] / mcs / class / System.Web / Test / System.Web.UI.WebControls / RepeaterTest.cs
1 //
2 // Tests for System.Web.UI.WebControls.Repeater.cs 
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 using NUnit.Framework;
32 using System;
33 using System.IO;
34 using System.Globalization;
35 using System.Web;
36 using System.Web.UI;
37 using System.Web.UI.WebControls;
38
39 namespace MonoTests.System.Web.UI.WebControls
40 {
41         [TestFixture]   
42         public class RepeaterTest {     
43                 class Poker : Repeater {
44                         
45                         public void TrackState () 
46                         {
47                                 TrackViewState ();
48                         }
49                         
50                         public object SaveState ()
51                         {
52                                 return SaveViewState ();
53                         }
54                         
55                         public void LoadState (object o)
56                         {
57                                 LoadViewState (o);
58                         }
59
60 #if NET_2_0
61                         public DataSourceSelectArguments GetSelectArguments()
62                         {
63                                 return SelectArguments;
64                         }
65
66                         public DataSourceSelectArguments DoCreateDataSourceSelectArguments ()
67                         {
68                                 return base.CreateDataSourceSelectArguments();
69                         }
70 #endif
71                 }
72
73 #if NET_2_0
74                 [Test]
75                 public void Repeater_DefaultsSelectArguments ()
76                 {
77                         Poker p = new Poker ();
78                         DataSourceSelectArguments args, args2;
79
80                         args = p.GetSelectArguments();
81                         args2 = p.DoCreateDataSourceSelectArguments();
82
83                         Assert.AreEqual (args, args2, "call == prop");
84
85                         Assert.IsNotNull (args, "property null check");
86                         Assert.IsTrue    (args != DataSourceSelectArguments.Empty, "property != Empty check");
87                         Assert.IsTrue    (args.Equals (DataSourceSelectArguments.Empty), "property but they are empty check");
88
89                         Assert.IsNotNull (args2, "method null check");
90                         Assert.IsTrue    (args2 != DataSourceSelectArguments.Empty, "method != Empty check");
91                         Assert.IsTrue    (args2.Equals (DataSourceSelectArguments.Empty), "method but they are empty check");
92
93                         /* check to see whether multiple calls give us different refs */
94                         args = p.DoCreateDataSourceSelectArguments();
95                         
96                         Assert.AreEqual (args, args2, "multiple calls, same ref");
97                 }
98 #endif
99         }
100 }