public void AddGroup_SubGroupDoesNotHaveParent_SetsParentProperty() { var parent = new TestGroup_InheritsGroupBase(); var subGroup = new SubGroup("Child"); parent.AddGroup(subGroup); Assert.Equal(parent, subGroup.Parent); }
public void AddGroup_SubGroupDoesNotHaveParent_AddsGroupToChildren() { var parent = new TestGroup_InheritsGroupBase(); var subGroup = new SubGroup("Child"); parent.AddGroup(subGroup); Assert.Contains(subGroup, parent.SubGroups); }
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); }
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); }
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); }
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); }