public void CopyWithChildren () { FirstMatchCodeGroup cgChild = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.Unrestricted))); FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None))); cg.AddChild (cgChild); FirstMatchCodeGroup cg2 = (FirstMatchCodeGroup) cg.Copy (); AssertEquals ("Children", cg.Children.Count, cg2.Children.Count); AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ()); }
public void Copy () { FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None))); FirstMatchCodeGroup cg2 = (FirstMatchCodeGroup) cg.Copy (); AssertEquals ("AttributeString", cg.AttributeString, cg2.AttributeString); AssertEquals ("Children", cg.Children.Count, cg2.Children.Count); AssertEquals ("Description", cg.Description, cg2.Description); AssertEquals ("MergeLogic", cg.MergeLogic, cg2.MergeLogic); AssertEquals ("Name", cg.Name, cg2.Name); AssertEquals ("PermissionSetName", cg.PermissionSetName, cg2.PermissionSetName); AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ()); }
public void ToFromXmlRoundtrip () { const string ps_Name = "TestName"; PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name)); FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), ps); cg.Name = "SomeName"; cg.Description = "Some Description"; Assert ("Equals (itself)", cg.Equals (cg)); SecurityElement se = cg.ToXml (); FirstMatchCodeGroup cg2 = new FirstMatchCodeGroup (new AllMembershipCondition(), ps); cg2.Name = "SomeOtherName"; cg2.Description = "Some Other Description"; Assert ("Equals (another)", !cg.Equals (cg2)); cg2.FromXml (se); Assert ("Equals (FromXml)", cg.Equals (cg2)); }