Example #1
0
		public void RemoveChild_NonExistant () 
		{
			PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));

			MyCodeGroup cgChild = new MyCodeGroup (new ApplicationDirectoryMembershipCondition (), ps);
			cgChild.Name = "ChildName";
			cgChild.Description = "Child Descripiton";

			MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
			cg.AddChild (cgChild);
			cg.RemoveChild (cgChild);
			cg.RemoveChild (cgChild);
			// no exception
		}
        public void RemoveChild_Null()
        {
            MyCodeGroup cg = new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));

            cg.RemoveChild(null);
            // no exception
        }
        public void RemoveChild()
        {
            PolicyStatement ps = new PolicyStatement(new NamedPermissionSet(ps_Name));
            MyCodeGroup     cg = new MyCodeGroup(new AllMembershipCondition(), ps);

            cg.Name        = "SomeName";
            cg.Description = "Some Description";

            MyCodeGroup cgChild = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);

            cgChild.Name        = "ChildName";
            cgChild.Description = "Child Descripiton";
            cg.AddChild(cgChild);

            MyCodeGroup cgChild2 = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);

            cgChild2.Name        = "ChildName2";
            cgChild2.Description = "Child Descripiton 2";
            cg.AddChild(cgChild2);

            Assert.AreEqual(2, cg.Children.Count, "Should be two children before the call to Remove()");
            cg.RemoveChild(cgChild);
            Assert.AreEqual(1, cg.Children.Count, "Should be one children after the call to Remove()");
            Assert.AreEqual("ChildName2", ((CodeGroup)cg.Children[0]).Name, "Remaining child does not have correct name");
        }
Example #4
0
		public void RemoveChild_Null () 
		{
			MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), new PolicyStatement(new PermissionSet (PermissionState.None)));
			cg.RemoveChild (null);
			// no exception
		}
Example #5
0
		public void RemoveChild ()
		{
			PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
			MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
			cg.Name = "SomeName";
			cg.Description = "Some Description";

			MyCodeGroup cgChild = new MyCodeGroup (new ApplicationDirectoryMembershipCondition (), ps);
			cgChild.Name = "ChildName";
			cgChild.Description = "Child Descripiton";
			cg.AddChild (cgChild);

			MyCodeGroup cgChild2 = new MyCodeGroup (new ApplicationDirectoryMembershipCondition (), ps);
			cgChild2.Name = "ChildName2";
			cgChild2.Description = "Child Descripiton 2";
			cg.AddChild (cgChild2);

			Assert.AreEqual (2, cg.Children.Count, "Should be two children before the call to Remove()");
			cg.RemoveChild(cgChild);
			Assert.AreEqual (1, cg.Children.Count, "Should be one children after the call to Remove()");
			Assert.AreEqual("ChildName2", ((CodeGroup)cg.Children[0]).Name, "Remaining child does not have correct name");
		}