public void ChangeParent_When_Child_Has_No_Parent() { Project new_parent = new Project(); Project child = new Project(); child.ChangeParent(new_parent); Assert.That(child.Parent, Is.EqualTo(new_parent)); Assert.That(new_parent.Children.Count, Is.EqualTo(1)); Assert.That(new_parent.Children.Contains(child)); }
public void ChangeParent_When_Parent_And_New_Parent_Is_Null() { Project project = new Project(); project.ChangeParent(null); Assert.That(project.Parent, Is.EqualTo(null)); }
public void ChangeParent_When_New_Parent_Is_Old_Parent() { Project parent = new Project(); Project child_1 = new Project(); Project child_2 = new Project(); parent.AddChild(child_1); parent.AddChild(child_2); child_1.ChangeParent(parent); Assert.That(child_1.Parent, Is.EqualTo(parent)); Assert.That(child_2.Parent, Is.EqualTo(parent)); Assert.That(parent.Children.Count, Is.EqualTo(2)); Assert.That(parent.Children.Contains(child_1)); Assert.That(parent.Children.Contains(child_2)); }
public void ChangeParent_When_New_Parent_Is_Null() { Project parent = new Project(); Project child_1 = new Project(); parent.AddChild(child_1); child_1.ChangeParent(null); Assert.That(child_1.Parent, Is.EqualTo(null)); Assert.That(parent.Children.Count, Is.EqualTo(0)); }
public void ChangeParent() { Project parent_1 = new Project(); Project parent_2 = new Project(); Project child = new Project(); parent_1.AddChild(child); Assert.That(child.Parent, Is.EqualTo(parent_1)); Assert.That(parent_1.Children.Count, Is.EqualTo(1)); Assert.That(parent_1.Children.Contains(child)); child.ChangeParent(parent_2); Assert.That(child.Parent, Is.EqualTo(parent_2)); Assert.That(parent_1.Children.IsNullOrEmpty(), Is.True); Assert.That(parent_2.Children.Count, Is.EqualTo(1)); Assert.That(parent_2.Children.Contains(child)); }