src/GenFx.Components.Tests/TreeEntityBaseTest.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 TreeEntityBase_CopyTo()
        {
            MockGeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                PopulationSeed = new MockPopulation(),
                SelectionOperator = new MockSelectionOperator(),
                FitnessEvaluator = new MockFitnessEvaluator(),
                GeneticEntitySeed = new TestTreeEntity()
            };
            TestTreeEntity entity = new TestTreeEntity();
            entity.Initialize(algorithm);
            entity.Age = 10;
            entity.SetRootNode(new TreeNode());
            TestTreeEntity newEntity = new TestTreeEntity();
            newEntity.Initialize(algorithm);
            entity.CopyTo(newEntity);
            Assert.Equal(entity.Age, newEntity.Age);
            Assert.NotNull(entity.RootNode);
        }
[ Fact ] public void TreeEntityBase_CopyTo ( ) { MockGeneticAlgorithm algorithm = new MockGeneticAlgorithm { PopulationSeed = new MockPopulation ( ) , SelectionOperator = new MockSelectionOperator ( ) , FitnessEvaluator = new MockFitnessEvaluator ( ) , GeneticEntitySeed = new TestTreeEntity ( ) } ; TestTreeEntity entity = new TestTreeEntity ( ) ; entity . Initialize ( algorithm ) ; entity . Age = 10 ; entity . SetRootNode ( new TreeNode ( ) ) ; TestTreeEntity newEntity = new TestTreeEntity ( ) ; newEntity . Initialize ( algorithm ) ; entity . CopyTo ( newEntity ) ; Assert . Equal ( entity . Age , newEntity . Age ) ; Assert . NotNull ( entity . RootNode ) ; }
Tests that the CopyTo method works correctly.
Tests that the CopyTo method works correctly .