src/GenFx.Components.Tests/TreeNodeTest.cs
/// <summary>
/// Tests that the CopyTo method works correctly.
/// </summary>
Tests that the CopyTo method works correctly.
Tests that the CopyTo method works correctly .
[Fact]
        public void TreeNode_CopyTo()
        {
            GeneticAlgorithm algorithm = GetAlgorithm();
            TestTreeEntity entity = new TestTreeEntity();
            entity.Initialize(algorithm);
            TreeNode node = new TreeNode();
            entity.SetRootNode(node);
            node.AppendChild(new TreeNode());
            node.Value = 10;
            TestTreeEntity newEntity = new TestTreeEntity();
            newEntity.Initialize(algorithm);
            TreeNode newParent = new TreeNode();
            newEntity.SetRootNode(newParent);
            TreeNode newNode = new TreeNode();
            node.CopyTo(newNode, newEntity, newParent);
            Assert.Same(newEntity, newNode.Tree);
            Assert.Same(newParent, newNode.ParentNode);
            Assert.NotSame(node.ChildNodes[0], newNode.ChildNodes[0]);
            Assert.Equal(node.Value, newNode.Value);
        }
[ Fact ] public void TreeNode_CopyTo ( ) { GeneticAlgorithm algorithm = GetAlgorithm ( ) ; TestTreeEntity entity = new TestTreeEntity ( ) ; entity . Initialize ( algorithm ) ; TreeNode node = new TreeNode ( ) ; entity . SetRootNode ( node ) ; node . AppendChild ( new TreeNode ( ) ) ; node . Value = 10 ; TestTreeEntity newEntity = new TestTreeEntity ( ) ; newEntity . Initialize ( algorithm ) ; TreeNode newParent = new TreeNode ( ) ; newEntity . SetRootNode ( newParent ) ; TreeNode newNode = new TreeNode ( ) ; node . CopyTo ( newNode , newEntity , newParent ) ; Assert . Same ( newEntity , newNode . Tree ) ; Assert . Same ( newParent , newNode . ParentNode ) ; Assert . NotSame ( node . ChildNodes [ 0 ] , newNode . ChildNodes [ 0 ] ) ; Assert . Equal ( node . Value , newNode . Value ) ; }
Tests that the CopyTo method works correctly.
Tests that the CopyTo method works correctly .