Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }