Esempio n. 1
0
        public void ToFromXmlRoundtrip()
        {
            const string    ps_Name = "TestName";
            PolicyStatement ps      = new PolicyStatement(new NamedPermissionSet(ps_Name));
            UnionCodeGroup  cg      = new UnionCodeGroup(new AllMembershipCondition(), ps);

            cg.Name        = "SomeName";
            cg.Description = "Some Description";
            Assert.IsTrue(cg.Equals(cg), "Equals (itself)");
            SecurityElement se = cg.ToXml();

            UnionCodeGroup cg2 = new UnionCodeGroup(new AllMembershipCondition(), ps);

            cg2.Name        = "SomeOtherName";
            cg2.Description = "Some Other Description";
            Assert.IsTrue(!cg.Equals(cg2), "Equals (another)");

            cg2.FromXml(se);
            Assert.IsTrue(cg.Equals(cg2), "Equals (FromXml)");
        }