예제 #1
0
        public void AddGroup_SubGroupDoesNotHaveParent_SetsParentProperty()
        {
            var parent   = new TestGroup_InheritsGroupBase();
            var subGroup = new SubGroup("Child");

            parent.AddGroup(subGroup);
            Assert.Equal(parent, subGroup.Parent);
        }
예제 #2
0
        public void AddGroup_SubGroupDoesNotHaveParent_AddsGroupToChildren()
        {
            var parent   = new TestGroup_InheritsGroupBase();
            var subGroup = new SubGroup("Child");

            parent.AddGroup(subGroup);
            Assert.Contains(subGroup, parent.SubGroups);
        }
예제 #3
0
        public void RemoveGroup_Group_RemovesParentFromChild()
        {
            var rootGroup  = new TestGroup_InheritsGroupBase("/");
            var childGroup = new SubGroup("Child");

            rootGroup.AddGroup(childGroup);
            rootGroup.RemoveGroup(childGroup);

            Assert.Null(childGroup.Parent);
        }
예제 #4
0
        public void RemoveGroup_Group_RemovesChildFromGroups()
        {
            var rootGroup = new TestGroup_InheritsGroupBase("/");
            var subGroup  = new SubGroup("Child");

            rootGroup.AddGroup(subGroup);
            rootGroup.RemoveGroup(subGroup);

            Assert.DoesNotContain(subGroup, rootGroup.SubGroups);
        }
예제 #5
0
        public void RemoveGroup_ParentDoesNotContainChild_DoesNothing()
        {
            var rootGroup     = new TestGroup_InheritsGroupBase("/");
            var subGroup      = new SubGroup("Child");
            var otherSubGroup = new SubGroup("Other");

            rootGroup.AddGroup(subGroup);
            rootGroup.RemoveGroup(otherSubGroup);

            Assert.Contains(subGroup, rootGroup.SubGroups);
            Assert.DoesNotContain(otherSubGroup, rootGroup.SubGroups);
        }
예제 #6
0
        public void AddGroup_SubGroupHasParent_OriginalParentRemovesChild()
        {
            var originalParent = new TestGroup_InheritsGroupBase("OriginalParent");
            var subGroup       = new SubGroup("Child");

            originalParent.AddGroup(subGroup);

            var newParent = new TestGroup_InheritsGroupBase("NewParent");

            newParent.AddGroup(subGroup);

            Assert.DoesNotContain(subGroup, originalParent.SubGroups);
            Assert.Same(newParent, subGroup.Parent);
        }