2 // Tests for System.Web.UI.WebControls.ButtonFieldBaseTest.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.
34 using System.Collections.Generic;
38 using System.Web.UI.WebControls;
41 using System.Collections;
42 using System.Collections.Specialized;
43 using NUnit.Framework;
49 namespace MonoTests.System.Web.UI.WebControls
51 class PokerButtonFieldBase : ButtonFieldBase
54 public PokerButtonFieldBase ()
60 public object SaveState ()
62 return SaveViewState ();
65 public void LoadState (object o)
70 public StateBag StateBag
72 get { return base.ViewState; }
75 protected override DataControlField CreateField ()
77 throw new Exception ("The method or operation is not implemented.");
80 public void DoCopyProperties (DataControlField newField)
82 base.CopyProperties (newField);
87 public class ButtonFieldBaseTest
90 public void ButtonFieldBase_DefaultProperty ()
92 PokerButtonFieldBase button = new PokerButtonFieldBase ();
93 Assert.AreEqual (ButtonType.Link, button.ButtonType, "ButtonType");
94 Assert.AreEqual (false, button.CausesValidation, "CausesValidation");
95 Assert.AreEqual (false, button.ShowHeader, "ShowHeader");
96 Assert.AreEqual ("", button.ValidationGroup, "ValidationGroup");
100 public void ButtonFieldBase_AssignProperty ()
102 PokerButtonFieldBase button = new PokerButtonFieldBase ();
103 button.ButtonType = ButtonType.Image;
104 Assert.AreEqual (ButtonType.Image, button.ButtonType, "ButtonType");
105 button.CausesValidation = true;
106 Assert.AreEqual (true, button.CausesValidation, "CausesValidation");
107 button.ShowHeader = true;
108 Assert.AreEqual (true, button.ShowHeader, "ShowHeader");
109 button.ValidationGroup = "test";
110 Assert.AreEqual ("test", button.ValidationGroup, "ValidationGroup");
114 public void ButtonFieldBase_CopyProperties ()
116 PokerButtonFieldBase button = new PokerButtonFieldBase ();
117 PokerButtonFieldBase copy = new PokerButtonFieldBase ();
118 button.ButtonType = ButtonType.Image;
119 button.CausesValidation = true;
120 button.ShowHeader = true;
121 button.ValidationGroup = "test";
122 button.DoCopyProperties (copy);
123 Assert.AreEqual ("test", copy.ValidationGroup, "ValidationGroup");
124 Assert.AreEqual (ButtonType.Image, copy.ButtonType, "ButtonType");
125 Assert.AreEqual (true, copy.CausesValidation, "CausesValidation");
126 Assert.AreEqual (true, copy.ShowHeader, "ShowHeader");