コード例 #1
0
        public void Unrestricted()
        {
            ZoneIdentityPermissionAttribute a = new ZoneIdentityPermissionAttribute(SecurityAction.Assert);

            a.Unrestricted = true;
            IPermission perm = a.CreatePermission();
        }
コード例 #2
0
        public void Zone_Invalid()
        {
            ZoneIdentityPermissionAttribute a = new ZoneIdentityPermissionAttribute(SecurityAction.Assert);

            a.Zone = (SecurityZone)Int32.MinValue;
            // no validation in attribute
        }
コード例 #3
0
        public void Default()
        {
            ZoneIdentityPermissionAttribute a = new ZoneIdentityPermissionAttribute(SecurityAction.Assert);

            Assert.AreEqual(a.ToString(), a.TypeId.ToString(), "TypeId");
            Assert.IsFalse(a.Unrestricted, "Unrestricted");
            Assert.AreEqual(SecurityZone.NoZone, a.Zone, "Zone");

            ZoneIdentityPermission perm = (ZoneIdentityPermission)a.CreatePermission();

            Assert.AreEqual(SecurityZone.NoZone, perm.SecurityZone, "CreatePermission-SecurityZone");
        }
コード例 #4
0
        public void Zone()
        {
            ZoneIdentityPermissionAttribute a = new ZoneIdentityPermissionAttribute(SecurityAction.Assert);

            Assert.AreEqual(SecurityZone.NoZone, a.Zone, "Zone=default");
            a.Zone = SecurityZone.Internet;
            Assert.AreEqual(SecurityZone.Internet, a.Zone, "Zone=Internet");
            a.Zone = SecurityZone.Intranet;
            Assert.AreEqual(SecurityZone.Intranet, a.Zone, "Zone=Intranet");
            a.Zone = SecurityZone.MyComputer;
            Assert.AreEqual(SecurityZone.MyComputer, a.Zone, "Zone=MyComputer");
            a.Zone = SecurityZone.NoZone;
            Assert.AreEqual(SecurityZone.NoZone, a.Zone, "Zone=NoZone");
            a.Zone = SecurityZone.Trusted;
            Assert.AreEqual(SecurityZone.Trusted, a.Zone, "Zone=Trusted");
            a.Zone = SecurityZone.Untrusted;
            Assert.AreEqual(SecurityZone.Untrusted, a.Zone, "Zone=Untrusted");
        }
コード例 #5
0
        public void Action()
        {
            ZoneIdentityPermissionAttribute a = new ZoneIdentityPermissionAttribute(SecurityAction.Assert);

            Assert.AreEqual(SecurityAction.Assert, a.Action, "Action=Assert");
            a.Action = SecurityAction.Demand;
            Assert.AreEqual(SecurityAction.Demand, a.Action, "Action=Demand");
            a.Action = SecurityAction.Deny;
            Assert.AreEqual(SecurityAction.Deny, a.Action, "Action=Deny");
            a.Action = SecurityAction.InheritanceDemand;
            Assert.AreEqual(SecurityAction.InheritanceDemand, a.Action, "Action=InheritanceDemand");
            a.Action = SecurityAction.LinkDemand;
            Assert.AreEqual(SecurityAction.LinkDemand, a.Action, "Action=LinkDemand");
            a.Action = SecurityAction.PermitOnly;
            Assert.AreEqual(SecurityAction.PermitOnly, a.Action, "Action=PermitOnly");
            a.Action = SecurityAction.RequestMinimum;
            Assert.AreEqual(SecurityAction.RequestMinimum, a.Action, "Action=RequestMinimum");
            a.Action = SecurityAction.RequestOptional;
            Assert.AreEqual(SecurityAction.RequestOptional, a.Action, "Action=RequestOptional");
            a.Action = SecurityAction.RequestRefuse;
            Assert.AreEqual(SecurityAction.RequestRefuse, a.Action, "Action=RequestRefuse");
        }
コード例 #6
0
ファイル: PermissionTests.cs プロジェクト: Corillian/corefx
 public static void ZoneIdentityPermissionAttributeCallMethods()
 {
     ZoneIdentityPermissionAttribute zipa = new ZoneIdentityPermissionAttribute(new Permissions.SecurityAction());
     IPermission ip = zipa.CreatePermission();
 }
コード例 #7
0
 public static void ZoneIdentityPermissionAttributeCallMethods()
 {
     ZoneIdentityPermissionAttribute zipa = new ZoneIdentityPermissionAttribute(new Permissions.SecurityAction());
     IPermission ip = zipa.CreatePermission();
 }
コード例 #8
0
 public void Action_Invalid()
 {
     ZoneIdentityPermissionAttribute a = new ZoneIdentityPermissionAttribute((SecurityAction)Int32.MinValue);
     // no validation in attribute
 }
コード例 #9
0
        public void TypeId()
        {
            ZoneIdentityPermissionAttribute a = new ZoneIdentityPermissionAttribute(SecurityAction.Assert);

            Assert.AreEqual(a.ToString(), a.TypeId.ToString(), "TypeId");
        }