public void FromXml_BadName()
        {
            PermissionSetCollection psc = new PermissionSetCollection();
            SecurityElement         se  = new SecurityElement("PermissionZetCollection");

            psc.FromXml(se);
        }
        public void FromXml_Roundtrip()
        {
            PermissionSetCollection psc = new PermissionSetCollection();
            string          expected    = psc.ToString();
            SecurityElement se          = psc.ToXml();

            psc.FromXml(se);
            string actual = psc.ToString();

            Assert.AreEqual(expected, actual, "Empty");

            PermissionSet none = new PermissionSet(PermissionState.None);

            psc.Add(none);
            expected = psc.ToString();
            se       = psc.ToXml();
            psc.FromXml(se);
            actual = psc.ToString();
            Assert.AreEqual(expected, actual, "1-None");

            none.AddPermission(new SecurityPermission(SecurityPermissionFlag.Assertion));
            expected = psc.ToString();
            se       = psc.ToXml();
            psc.FromXml(se);
            actual = psc.ToString();
            Assert.AreEqual(expected, actual, "1-Assertion");
            Assert.AreEqual(1, psc.Count, "1");

            PermissionSet unr = new PermissionSet(PermissionState.Unrestricted);

            psc.Add(unr);
            expected = psc.ToString();
            se       = psc.ToXml();
            psc.FromXml(se);
            actual = psc.ToString();
            Assert.AreEqual(expected, actual, "2-Assertion+Unrestricted");
            Assert.AreEqual(2, psc.Count, "2");
        }
        public void FromXml_Null()
        {
            PermissionSetCollection psc = new PermissionSetCollection();

            psc.FromXml(null);
        }