// "special" behavior inherited from ResourceBasePermission // [ExpectedException (typeof (ArgumentException))] public void IsSubsetOf_BadPermission () { PerformanceCounterPermission pcp1 = new PerformanceCounterPermission (PermissionState.Unrestricted); Assert.IsFalse (pcp1.IsSubsetOf (new SecurityPermission (SecurityPermissionFlag.Assertion))); }
public void IsSubset_Unrestricted () { // IsSubset with unrestricted // a. source (this) is unrestricted -> target is never a subset // b. destination (target) is unrestricted -> source is always a subset PerformanceCounterPermission pcp1 = new PerformanceCounterPermission (PermissionState.Unrestricted); foreach (PerformanceCounterPermissionAccess pcpa in AllAccess) { PerformanceCounterPermission pcp2 = new PerformanceCounterPermission (PermissionState.None); pcp2.PermissionEntries.Add (new PerformanceCounterPermissionEntry (pcpa, pcpa.ToString (), String.Empty)); Assert.IsFalse (pcp1.IsSubsetOf (pcp2), "target " + pcpa.ToString ()); Assert.IsTrue (pcp2.IsSubsetOf (pcp1), "source " + pcpa.ToString ()); } Assert.IsTrue (pcp1.IsSubsetOf (pcp1), "Unrestricted.IsSubsetOf(Unrestricted)"); }
public void IsSubset_Null () { PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None); #if NET_2_0 Assert.IsTrue (pcp.IsSubsetOf (null), "null"); #else Assert.IsFalse (pcp.IsSubsetOf (null), "null"); #endif }
public void IsSubset_Self () { foreach (PerformanceCounterPermissionAccess pcpa in AllAccess) { PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None); pcp.PermissionEntries.Add (new PerformanceCounterPermissionEntry (pcpa, pcpa.ToString (), String.Empty)); Assert.IsTrue (pcp.IsSubsetOf (pcp), pcpa.ToString ()); } }
public void IsSubset_Null () { PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None); Assert.IsTrue (pcp.IsSubsetOf (null), "null"); }