public void Skill_AddParent() { ILevelFormula formula = new MockLevelFormula(); Skill child = new Skill("child", formula); Skill parent = new Skill("parent", formula); child.AddParent(parent); Assert.AreSame(parent, child.parents.First()); child.AddParent(parent); Assert.AreEqual(1, child.parents.Count); }
public void Skill_PreventCircularParents() { ILevelFormula formula = new MockLevelFormula(); Skill child = new Skill("child", formula); Skill parent = new Skill("parent", formula); Skill grandparent = new Skill("grandparent", formula); child.AddParent(parent); Assert.False(parent.AddParent(child)); Assert.AreEqual(0, parent.parents.Count); parent.AddParent(grandparent); Assert.False(grandparent.AddParent(child)); }
public void Skill_AncestoryContains() { ILevelFormula formula = new MockLevelFormula(); Skill child = new Skill("child", formula); Skill parent = new Skill("parent", formula); Skill otherParent = new Skill("otherParent", formula); Skill grandparent = new Skill("grandparent", formula); Skill uncle = new Skill("uncle", formula); child.AddParent(parent); parent.AddParent(grandparent); uncle.AddParent(grandparent); Assert.IsTrue(child.AncestryContains(grandparent)); Assert.IsFalse(child.AncestryContains(uncle)); otherParent.AddParent(grandparent); child.AddParent(otherParent); Assert.IsTrue(child.AncestryContains(grandparent)); }
public void Skill_IsChildOf() { ILevelFormula formula = new MockLevelFormula(); Skill child = new Skill("child", formula); Skill parent = new Skill("parent", formula); Skill uncle = new Skill("uncle", formula); child.AddParent(parent); Assert.True(child.IsChildOf(parent)); Assert.False(child.IsChildOf(uncle)); }