public void NewerSetOverwritesPreviousNodeInfo() { GameTreeNode node = new GameTreeNode(); var originalInfo = new TestGameTreeNodeInfo("original"); var updatedInfo = new TestGameTreeNodeInfo("new"); node.SetNodeInfo(originalInfo); node.SetNodeInfo(updatedInfo); var retrievedInfo = node.GetNodeInfo <TestGameTreeNodeInfo>(); Assert.IsNotNull(retrievedInfo); Assert.AreEqual("new", retrievedInfo.TestInfo); }
public void NodeInfoIsNotRecreatedWithFunctor() { GameTreeNode node = new GameTreeNode(); var info = new TestGameTreeNodeInfo("custom"); node.SetNodeInfo(info); var retrievedInfo = node.GetOrCreateNodeInfo(() => new TestGameTreeNodeInfo("different")); Assert.IsNotNull(retrievedInfo); Assert.AreEqual("custom", retrievedInfo.TestInfo); }
public void NodeInfoIsNotRecreated() { GameTreeNode node = new GameTreeNode(); var info = new TestGameTreeNodeInfo("custom"); node.SetNodeInfo(info); var retrievedInfo = node.GetOrCreateNodeInfo <TestGameTreeNodeInfo>(); Assert.IsNotNull(retrievedInfo); Assert.AreEqual("custom", retrievedInfo.TestInfo); }