public void IsSubset_Null() { ServiceControllerPermission scp = new ServiceControllerPermission(PermissionState.None); #if NET_2_0 Assert.IsTrue(scp.IsSubsetOf(null), "null"); #else Assert.IsFalse(scp.IsSubsetOf(null), "null"); #endif }
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 ServiceControllerPermission scp1 = new ServiceControllerPermission(PermissionState.Unrestricted); foreach (ServiceControllerPermissionAccess scpa in AllAccess) { ServiceControllerPermission scp2 = new ServiceControllerPermission(PermissionState.None); scp2.PermissionEntries.Add(new ServiceControllerPermissionEntry(scpa, "localhost", scpa.ToString())); Assert.IsFalse(scp1.IsSubsetOf(scp2), "target " + scpa.ToString()); Assert.IsTrue(scp2.IsSubsetOf(scp1), "source " + scpa.ToString()); } Assert.IsTrue(scp1.IsSubsetOf(scp1), "Unrestricted.IsSubsetOf(Unrestricted)"); }
public void IsSubset_Self() { foreach (ServiceControllerPermissionAccess scpa in AllAccess) { ServiceControllerPermission scp = new ServiceControllerPermission(PermissionState.None); scp.PermissionEntries.Add(new ServiceControllerPermissionEntry(scpa, "localhost", scpa.ToString())); Assert.IsTrue(scp.IsSubsetOf(scp), scpa.ToString()); } }
// "special" behavior inherited from ResourceBasePermission // [ExpectedException (typeof (ArgumentException))] public void IsSubsetOf_BadPermission() { ServiceControllerPermission scp1 = new ServiceControllerPermission(PermissionState.Unrestricted); Assert.IsFalse(scp1.IsSubsetOf(new SecurityPermission(SecurityPermissionFlag.Assertion))); }
public void IsSubset_Null() { ServiceControllerPermission scp = new ServiceControllerPermission(PermissionState.None); Assert.IsTrue(scp.IsSubsetOf(null), "null"); }