public void AddSelf() { NpcChatProject project = new NpcChatProject(); DialogTree tree = project.ProjectDialogs.CreateNewDialogTree(); DialogTreeBranch start = tree.GetStart(); DialogTreeBranch aBranch = tree.CreateNewBranch(); Assert.NotNull(aBranch); Assert.IsFalse(start.AddChild(start), "Should be able to add self"); Assert.IsFalse(start.AddParent(start), "Should be able to add self"); }
public void AddParentDouble() { NpcChatProject project = new NpcChatProject(); DialogTree tree = project.ProjectDialogs.CreateNewDialogTree(); DialogTreeBranch start = tree.GetStart(); DialogTreeBranch aBranch = tree.CreateNewBranch(); Assert.NotNull(aBranch); Assert.IsTrue(aBranch.AddParent(start)); Assert.IsFalse(aBranch.AddParent(start)); Assert.IsTrue(aBranch.Parents.Contains(start)); Assert.AreEqual(1, aBranch.Parents.Count); Assert.AreEqual(0, aBranch.Children.Count); Assert.IsTrue(start.Children.Contains(aBranch)); Assert.AreEqual(0, start.Parents.Count); Assert.AreEqual(1, start.Children.Count); }
public void RemoveParent() { NpcChatProject project = new NpcChatProject(); DialogTree tree = project.ProjectDialogs.CreateNewDialogTree(); DialogTreeBranch start = tree.GetStart(); DialogTreeBranch aBranch = tree.CreateNewBranch(); Assert.IsTrue(aBranch.AddParent(start)); Assert.AreEqual(1, aBranch.Parents.Count); Assert.AreEqual(1, start.Children.Count); Assert.IsTrue(aBranch.RemoveParent(start)); Assert.AreEqual(0, aBranch.Parents.Count); Assert.AreEqual(0, start.Children.Count); }
public void AddParentCallback() { NpcChatProject project = new NpcChatProject(); DialogTree tree = project.ProjectDialogs.CreateNewDialogTree(); DialogTreeBranch start = tree.GetStart(); DialogTreeBranch aBranch = tree.CreateNewBranch(); bool parentCallback = false, childCallback = false; aBranch.OnBranchParentAdded += id => parentCallback = true; start.OnBranchChildAdded += id => childCallback = true; Assert.IsTrue(aBranch.AddParent(start)); Assert.IsTrue(parentCallback, "Parent Added Callback failed"); Assert.IsTrue(childCallback, "Child Added Callback failed"); }
protected override void RelationshipCreate(DialogTreeBranch parent, DialogTreeBranch child) { child.AddParent(parent); }