LoginCas.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // LoginCas.cs - CAS unit tests for System.Web.UI.WebControls.Login
  3. //
  4. // Author:
  5. // Sebastien Pouliot <[email protected]>
  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. #if NET_2_0
  29. using NUnit.Framework;
  30. using System;
  31. using System.Security;
  32. using System.Security.Permissions;
  33. using System.Web;
  34. using System.Web.UI.WebControls;
  35. using MonoTests.System.Web.UI.WebControls;
  36. namespace MonoCasTests.System.Web.UI.WebControls {
  37. [TestFixture]
  38. [Category ("CAS")]
  39. public class LoginCas : AspNetHostingMinimal {
  40. [Test]
  41. [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
  42. public void Deny_Unrestricted ()
  43. {
  44. LoginTest unit = new LoginTest ();
  45. unit.ReadOnlyFields ();
  46. unit.DefaultProperties ();
  47. unit.AssignToDefaultProperties ();
  48. unit.NullProperties ();
  49. unit.BorderPadding ();
  50. unit.FailureAction_All ();
  51. unit.LoginButtonType_All ();
  52. unit.Orientation_All ();
  53. unit.TextLayout_All ();
  54. unit.SaveViewState ();
  55. unit.OnBubbleEvent_Cancel_OnLoggingIn ();
  56. unit.OnLoggingIn_False ();
  57. unit.OnLoggingIn_True ();
  58. unit.OnLoginError ();
  59. unit.OnLoggedIn ();
  60. }
  61. [Test]
  62. [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
  63. public void OnAuthenticate_True_Deny_Unrestricted ()
  64. {
  65. LoginTest unit = new LoginTest ();
  66. try {
  67. unit.OnAuthenticate_True ();
  68. }
  69. catch (TypeInitializationException) {
  70. // ms 2.0 - depending on the test run-order the HttpRuntime may throw
  71. }
  72. }
  73. [Test]
  74. [SecurityPermission (SecurityAction.PermitOnly, ControlPrincipal = true)]
  75. public void PermitOnly_ControlPrincipal ()
  76. {
  77. LoginTest unit = new LoginTest ();
  78. try {
  79. unit.OnBubbleEvent ();
  80. unit.OnAuthenticate_False ();
  81. }
  82. catch (TypeInitializationException) {
  83. // ms 2.0 - depending on the test run-order the HttpRuntime may throw
  84. }
  85. }
  86. [Test]
  87. [SecurityPermission (SecurityAction.Deny, ControlPrincipal = true)]
  88. public void OnBubbleEvent_Deny_ControlPrincipal ()
  89. {
  90. LoginTest unit = new LoginTest ();
  91. unit.OnBubbleEvent ();
  92. }
  93. [Test]
  94. [SecurityPermission (SecurityAction.Deny, ControlPrincipal = true)]
  95. public void OnAuthenticate_False_Deny_ControlPrincipal ()
  96. {
  97. LoginTest unit = new LoginTest ();
  98. unit.OnAuthenticate_False ();
  99. }
  100. // LinkDemand
  101. public override Type Type {
  102. get { return typeof (Login); }
  103. }
  104. }
  105. }
  106. #endif