public void Unrestricted()
        {
            AspNetHostingPermissionAttribute a = new AspNetHostingPermissionAttribute(SecurityAction.Assert);

            a.Unrestricted = true;
            AspNetHostingPermission anhp = (AspNetHostingPermission)a.CreatePermission();

            Assert.IsTrue(anhp.IsUnrestricted(), "IsUnrestricted");
            Assert.AreEqual(AspNetHostingPermissionLevel.None, a.Level, "None");

            a.Unrestricted = false;
            anhp           = (AspNetHostingPermission)a.CreatePermission();
            Assert.IsFalse(anhp.IsUnrestricted(), "!IsUnrestricted");
        }
Exemplo n.º 2
0
        public void Constructor_Deny_Unrestricted()
        {
            AspNetHostingPermissionAttribute a = new AspNetHostingPermissionAttribute(SecurityAction.Assert);

            Assert.AreEqual(AspNetHostingPermissionLevel.None, a.Level, "Level");
            a.Level = AspNetHostingPermissionLevel.Minimal;
            Assert.IsNotNull(a.CreatePermission(), "CreatePermission");
        }
        public void Default()
        {
            AspNetHostingPermissionAttribute a = new AspNetHostingPermissionAttribute(SecurityAction.Assert);

            Assert.AreEqual(a.ToString(), a.TypeId.ToString(), "TypeId");
            Assert.IsFalse(a.Unrestricted, "Unrestricted");
            Assert.AreEqual(AspNetHostingPermissionLevel.None, a.Level, "AspNetHostingPermissionLevel");

            AspNetHostingPermission anhp = (AspNetHostingPermission)a.CreatePermission();

            Assert.IsFalse(anhp.IsUnrestricted(), "IsUnrestricted");
        }
Exemplo n.º 4
0
 public static void AspNetHostingPermissionAttributeCallMethods()
 {
     var apa = new AspNetHostingPermissionAttribute(new SecurityAction());
     AspNetHostingPermissionLevel level = apa.Level;
     IPermission ip = apa.CreatePermission();
 }