AspNetHostingNone.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // AspNetHostingNone.cs - CAS unit tests helper for System.Web
  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. using NUnit.Framework;
  29. using System;
  30. using System.Security;
  31. using System.Security.Permissions;
  32. using System.Web;
  33. namespace MonoCasTests {
  34. public abstract class AspNetHostingNone : AspNetHostingPermissionHelper {
  35. [Test]
  36. [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Unrestricted)]
  37. public void LinkDemand_PermitOnly_Unrestricted ()
  38. {
  39. Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.Unrestricted));
  40. }
  41. [Test]
  42. [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.High)]
  43. public void LinkDemand_PermitOnly_High ()
  44. {
  45. Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.High));
  46. }
  47. [Test]
  48. [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Medium)]
  49. public void LinkDemand_PermitOnly_Medium ()
  50. {
  51. Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.Medium));
  52. }
  53. [Test]
  54. [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Low)]
  55. public void LinkDemand_PermitOnly_Low ()
  56. {
  57. Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.Low));
  58. }
  59. [Test]
  60. [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.Minimal)]
  61. public void LinkDemand_PermitOnly_Minimal ()
  62. {
  63. Assert.IsNotNull (CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.Minimal));
  64. }
  65. [Test]
  66. [AspNetHostingPermission (SecurityAction.PermitOnly, Level = AspNetHostingPermissionLevel.None)]
  67. public void LinkDemand_PermitOnly_None ()
  68. {
  69. CreateControl (SecurityAction.PermitOnly, AspNetHostingPermissionLevel.None);
  70. }
  71. [Test]
  72. [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Unrestricted)]
  73. public void LinkDemand_Deny_Unrestricted ()
  74. {
  75. CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.Unrestricted);
  76. }
  77. [Test]
  78. [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.High)]
  79. public void LinkDemand_Deny_High ()
  80. {
  81. CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.High);
  82. }
  83. [Test]
  84. [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Medium)]
  85. public void LinkDemand_Deny_Medium ()
  86. {
  87. CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.Medium);
  88. }
  89. [Test]
  90. [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Low)]
  91. public void LinkDemand_Deny_Low ()
  92. {
  93. CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.Low);
  94. }
  95. [Test]
  96. [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.Minimal)]
  97. public void LinkDemand_Deny_Minimal ()
  98. {
  99. CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.Minimal);
  100. }
  101. [Test]
  102. [AspNetHostingPermission (SecurityAction.Deny, Level = AspNetHostingPermissionLevel.None)]
  103. public void LinkDemand_Deny_None ()
  104. {
  105. Assert.IsNotNull (CreateControl (SecurityAction.Deny, AspNetHostingPermissionLevel.None));
  106. }
  107. }
  108. }