2007-01-28 yonik <yonik@mainsoft.com>
[mono.git] / mcs / class / System.Web / Test / System.Web.UI.WebControls / LoginCas.cs
1 //
2 // LoginCas.cs - CAS unit tests for System.Web.UI.WebControls.Login
3 //
4 // Author:
5 //      Sebastien Pouliot  <sebastien@ximian.com>
6 //
7 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 #if NET_2_0
30
31 using NUnit.Framework;
32
33 using System;
34 using System.Security;
35 using System.Security.Permissions;
36 using System.Web;
37 using System.Web.UI.WebControls;
38
39 using MonoTests.System.Web.UI.WebControls;
40
41 namespace MonoCasTests.System.Web.UI.WebControls {
42
43         [TestFixture]
44         [Category ("CAS")]
45         public class LoginCas : AspNetHostingMinimal {
46
47                 [Test]
48                 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
49                 public void Deny_Unrestricted ()
50                 {
51                         LoginTest unit = new LoginTest ();
52                         unit.ReadOnlyFields ();
53                         unit.DefaultProperties ();
54                         unit.AssignToDefaultProperties ();
55                         unit.NullProperties ();
56                         unit.BorderPadding ();
57                         unit.FailureAction_All ();
58                         unit.LoginButtonType_All ();
59                         unit.Orientation_All ();
60                         unit.TextLayout_All ();
61                         unit.SaveViewState ();
62                         unit.OnBubbleEvent_Cancel_OnLoggingIn ();
63                         unit.OnLoggingIn_False ();
64                         unit.OnLoggingIn_True ();
65                         unit.OnLoginError ();
66                         unit.OnLoggedIn ();
67                 }
68
69                 [Test]
70                 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
71                 public void OnAuthenticate_True_Deny_Unrestricted ()
72                 {
73                         LoginTest unit = new LoginTest ();
74                         try {
75                                 unit.OnAuthenticate_True ();
76                         }
77                         catch (TypeInitializationException) {
78                                 // ms 2.0 - depending on the test run-order the HttpRuntime may throw
79                         }
80                 }
81
82                 [Test]
83                 [SecurityPermission (SecurityAction.PermitOnly, ControlPrincipal = true)]
84                 public void PermitOnly_ControlPrincipal ()
85                 {
86                         LoginTest unit = new LoginTest ();
87                         try {
88                                 unit.OnBubbleEvent ();
89                                 unit.OnAuthenticate_False ();
90                         }
91                         catch (TypeInitializationException) {
92                                 // ms 2.0 - depending on the test run-order the HttpRuntime may throw
93                         }
94                 }
95
96                 [Test]
97                 [SecurityPermission (SecurityAction.Deny, ControlPrincipal = true)]
98                 public void OnBubbleEvent_Deny_ControlPrincipal ()
99                 {
100                         LoginTest unit = new LoginTest ();
101                         unit.OnBubbleEvent ();
102                 }
103
104                 [Test]
105                 [SecurityPermission (SecurityAction.Deny, ControlPrincipal = true)]
106                 public void OnAuthenticate_False_Deny_ControlPrincipal ()
107                 {
108                         LoginTest unit = new LoginTest ();
109                         unit.OnAuthenticate_False ();
110                 }
111
112                 // LinkDemand
113
114                 public override Type Type {
115                         get { return typeof (Login); }
116                 }
117         }
118 }
119
120 #endif