public void TestAddChild() { var parent = new Org(Guid.NewGuid()) { Name = "parentName" }; var child1 = new Org(Guid.NewGuid()) { Name = "child1" }; var child1Child = new Org(Guid.NewGuid()) { Name = "child1child" }; child1.Add(child1Child); Assert.AreEqual(child1.Id.ToString(), child1Child.OrderId); Assert.AreEqual(child1, child1Child.Parent); Assert.IsTrue(child1.Contains(child1Child)); parent.Add(child1); Assert.AreEqual(parent.Id.ToString(), child1.OrderId); Assert.AreEqual(parent.Id + "." + child1.Id, child1Child.OrderId); Assert.AreEqual(parent, child1.Parent); }
public void TestAddChild() { var parent = new Org(Guid.NewGuid()) {Name = "parentName"}; var child1 = new Org(Guid.NewGuid()) {Name = "child1"}; var child1Child = new Org(Guid.NewGuid()) {Name = "child1child"}; child1.Add(child1Child); Assert.AreEqual(child1.Id.ToString(), child1Child.OrderId); Assert.AreEqual(child1, child1Child.Parent); Assert.IsTrue(child1.Contains(child1Child)); parent.Add(child1); Assert.AreEqual(parent.Id.ToString(), child1.OrderId); Assert.AreEqual(parent.Id + "." + child1.Id, child1Child.OrderId); Assert.AreEqual(parent, child1.Parent); }
public void TestLevelUp() { var parent = new Org(Guid.NewGuid()) { Name = "parentName" }; var child1 = new Org(Guid.NewGuid()) { Name = "child1" }; parent.Add(child1); Assert.IsFalse(parent.LevelUp()); Assert.IsTrue(child1.LevelUp()); Assert.IsNull(child1.Parent); Assert.IsNull(child1.OrderId); Assert.IsFalse(parent.Contains(child1)); }
public void TestLevelUp() { var parent = new Org(Guid.NewGuid()) {Name = "parentName"}; var child1 = new Org(Guid.NewGuid()) {Name = "child1"}; parent.Add(child1); Assert.IsFalse(parent.LevelUp()); Assert.IsTrue(child1.LevelUp()); Assert.IsNull(child1.Parent); Assert.IsNull(child1.OrderId); Assert.IsFalse(parent.Contains(child1)); }