public void Union_Null()
        {
            EventLogPermission elp = new EventLogPermission(PermissionState.None);

            elp.PermissionEntries.Add(new EventLogPermissionEntry(EventLogPermissionAccess.None, "localhost"));
            // Union with null is a simple copy
            EventLogPermission union = (EventLogPermission)elp.Union(null);

            Assert.IsNotNull(elp.PermissionEntries.Count, "Count");
        }
 public void Union_Self()
 {
     foreach (EventLogPermissionAccess elpa in AllAccess)
     {
         EventLogPermission elp = new EventLogPermission(PermissionState.None);
         elp.PermissionEntries.Add(new EventLogPermissionEntry(elpa, elpa.ToString()));
         EventLogPermission union = (EventLogPermission)elp.Union(elp);
         Assert.IsFalse(union.IsUnrestricted(), "IsUnrestricted " + elpa.ToString());
         Assert.AreEqual(1, union.PermissionEntries.Count, "Count " + elpa.ToString());
     }
 }
        public void Union_None()
        {
            EventLogPermission elp1 = new EventLogPermission(PermissionState.None);

            foreach (EventLogPermissionAccess elpa in AllAccess)
            {
                EventLogPermission elp2 = new EventLogPermission(PermissionState.None);
                elp2.PermissionEntries.Add(new EventLogPermissionEntry(elpa, elpa.ToString()));
                EventLogPermission union = (EventLogPermission)elp1.Union(elp2);
                Assert.IsFalse(union.IsUnrestricted(), "target.IsUnrestricted " + elpa.ToString());
                Assert.AreEqual(1, union.PermissionEntries.Count, "target.Count " + elpa.ToString());

                union = (EventLogPermission)elp2.Union(elp1);
                Assert.IsFalse(union.IsUnrestricted(), "source.IsUnrestricted " + elpa.ToString());
                Assert.AreEqual(1, union.PermissionEntries.Count, "source.Count " + elpa.ToString());
            }
        }
        public void Union_BadPermission()
        {
            EventLogPermission elp1 = new EventLogPermission(PermissionState.Unrestricted);

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