public void Default () { SiteIdentityPermissionAttribute a = new SiteIdentityPermissionAttribute (SecurityAction.Assert); Assert.IsNull (a.Site, "Site"); Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId"); Assert.IsFalse (a.Unrestricted, "Unrestricted"); }
public void Action () { SiteIdentityPermissionAttribute a = new SiteIdentityPermissionAttribute (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"); #if NET_2_0 a.Action = SecurityAction.DemandChoice; Assert.AreEqual (SecurityAction.DemandChoice, a.Action, "Action=DemandChoice"); a.Action = SecurityAction.InheritanceDemandChoice; Assert.AreEqual (SecurityAction.InheritanceDemandChoice, a.Action, "Action=InheritanceDemandChoice"); a.Action = SecurityAction.LinkDemandChoice; Assert.AreEqual (SecurityAction.LinkDemandChoice, a.Action, "Action=LinkDemandChoice"); #endif }
public void DefaultPermission () { SiteIdentityPermissionAttribute a = new SiteIdentityPermissionAttribute (SecurityAction.Assert); Assert.IsNull (a.Site, "Site"); // SiteIdentityPermission would throw a ArgumentException for a null site ... SiteIdentityPermission perm = (SiteIdentityPermission) a.CreatePermission (); // ... but this works ... Assert.IsNotNull (perm, "CreatePermission(null site)"); // ... but this doesn't! (FIXED IN 2.0 NOV CTP) string site = perm.Site; }
public void Site () { SiteIdentityPermissionAttribute a = new SiteIdentityPermissionAttribute (SecurityAction.Assert); a.Site = "mono"; Assert.AreEqual ("mono", a.Site, "Site-1"); a.Site = null; Assert.IsNull (a.Site, "Site-2"); a.Site = "mono again"; Assert.AreEqual ("mono again", a.Site, "Site-3"); }
public void Unrestricted () { SiteIdentityPermissionAttribute a = new SiteIdentityPermissionAttribute (SecurityAction.Assert); a.Unrestricted = true; IPermission perm = a.CreatePermission (); }