public void Copy()
 {
     foreach (EventLogPermissionAccess elpa in AllAccess)
     {
         EventLogPermission      elp  = new EventLogPermission(PermissionState.None);
         EventLogPermissionEntry elpe = new EventLogPermissionEntry(elpa, elpa.ToString());
         elp.PermissionEntries.Add(elpe);
         EventLogPermission copy = (EventLogPermission)elp.Copy();
         Assert.AreEqual(1, copy.PermissionEntries.Count, "Count==1");
         Assert.AreEqual(elpa, elp.PermissionEntries [0].PermissionAccess, elpa.ToString());
     }
 }
        public void PermissionState_Unrestricted()
        {
            PermissionState    ps  = PermissionState.Unrestricted;
            EventLogPermission elp = new EventLogPermission(ps);

            Assert.AreEqual(0, elp.PermissionEntries.Count, "PermissionEntries");
            Assert.IsTrue(elp.IsUnrestricted(), "IsUnrestricted");

            SecurityElement se = elp.ToXml();

            // only class and version are present
            Assert.AreEqual("true", se.Attribute("Unrestricted"), "Xml-Unrestricted");
            Assert.IsNull(se.Children, "Xml-Children");

            EventLogPermission copy = (EventLogPermission)elp.Copy();

            Assert.IsFalse(Object.ReferenceEquals(elp, copy), "ReferenceEquals");
            Assert.AreEqual(elp.PermissionEntries.Count, copy.PermissionEntries.Count, "copy-PermissionEntries");
            Assert.AreEqual(elp.IsUnrestricted(), copy.IsUnrestricted(), "copy-IsUnrestricted ()");
        }