public void CopyWithChildren()
        {
            NetCodeGroup cgChild = new NetCodeGroup(new AllMembershipCondition());
            NetCodeGroup cg      = new NetCodeGroup(new AllMembershipCondition());

            cg.AddChild(cgChild);
            NetCodeGroup cg2 = (NetCodeGroup)cg.Copy();

            Assert.AreEqual(cg.Children.Count, cg2.Children.Count, "Children");
            Assert.AreEqual(cg.ToXml().ToString(), cg2.ToXml().ToString(), "ToXml");
        }
        public void Copy()
        {
            NetCodeGroup cg  = new NetCodeGroup(new AllMembershipCondition());
            NetCodeGroup cg2 = (NetCodeGroup)cg.Copy();

            Assert.AreEqual(cg.AttributeString, cg2.AttributeString, "AttributeString");
            Assert.AreEqual(cg.Children.Count, cg2.Children.Count, "Children");
            Assert.AreEqual(cg.Description, cg2.Description, "Description");
            Assert.AreEqual(cg.MergeLogic, cg2.MergeLogic, "MergeLogic");
            Assert.AreEqual(cg.Name, cg2.Name, "Name");
            Assert.AreEqual(cg.PermissionSetName, cg2.PermissionSetName, "PermissionSetName");
            Assert.AreEqual(cg.ToXml().ToString(), cg2.ToXml().ToString(), "ToXml");
        }
        public void ToFromXmlRoundtrip()
        {
            NetCodeGroup cg = new NetCodeGroup(new AllMembershipCondition());

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

            NetCodeGroup cg2 = new NetCodeGroup(new AllMembershipCondition());

            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)");
        }