Ejemplo n.º 1
0
        public void Union_Null()
        {
            ServiceControllerPermission scp = new ServiceControllerPermission(PermissionState.None);

            scp.PermissionEntries.Add(new ServiceControllerPermissionEntry(ServiceControllerPermissionAccess.None, "localhost", "http"));
            // Union with null is a simple copy
            ServiceControllerPermission union = (ServiceControllerPermission)scp.Union(null);

            Assert.AreEqual(1, union.PermissionEntries.Count, "Count");
        }
Ejemplo n.º 2
0
 public void Union_Self()
 {
     foreach (ServiceControllerPermissionAccess scpa in AllAccess)
     {
         ServiceControllerPermission scp = new ServiceControllerPermission(PermissionState.None);
         scp.PermissionEntries.Add(new ServiceControllerPermissionEntry(scpa, "localhost", scpa.ToString()));
         ServiceControllerPermission union = (ServiceControllerPermission)scp.Union(scp);
         Assert.IsFalse(union.IsUnrestricted(), "IsUnrestricted " + scpa.ToString());
         Assert.AreEqual(1, union.PermissionEntries.Count, "Count " + scpa.ToString());
     }
 }
Ejemplo n.º 3
0
        public void Union_None()
        {
            ServiceControllerPermission scp1 = new ServiceControllerPermission(PermissionState.None);

            foreach (ServiceControllerPermissionAccess scpa in AllAccess)
            {
                ServiceControllerPermission scp2 = new ServiceControllerPermission(PermissionState.None);
                scp2.PermissionEntries.Add(new ServiceControllerPermissionEntry(scpa, "localhost", scpa.ToString()));
                ServiceControllerPermission union = (ServiceControllerPermission)scp1.Union(scp2);
                Assert.IsFalse(union.IsUnrestricted(), "target.IsUnrestricted " + scpa.ToString());
                Assert.AreEqual(1, union.PermissionEntries.Count, "target.Count " + scpa.ToString());

                union = (ServiceControllerPermission)scp2.Union(scp1);
                Assert.IsFalse(union.IsUnrestricted(), "source.IsUnrestricted " + scpa.ToString());
                Assert.AreEqual(1, union.PermissionEntries.Count, "source.Count " + scpa.ToString());
            }
        }
Ejemplo n.º 4
0
        public void Union_BadPermission()
        {
            ServiceControllerPermission scp1 = new ServiceControllerPermission(PermissionState.Unrestricted);

            scp1.Union(new SecurityPermission(SecurityPermissionFlag.Assertion));
        }