src/GenFx.Components.Tests/TreeEntityBaseTest.cs
/// <summary>
/// Tests that the GetSize method works correctly.
/// </summary>
Tests that the GetSize method works correctly.
Tests that the GetSize method works correctly .
[Fact]
        public void TreeEntityBase_GetSize()
        {
            MockGeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                PopulationSeed = new MockPopulation(),
                SelectionOperator = new MockSelectionOperator(),
                FitnessEvaluator = new MockFitnessEvaluator(),
                GeneticEntitySeed = new TestTreeEntity()
            };
            TestTreeEntity entity = new TestTreeEntity();
            entity.Initialize(algorithm);
            int size = entity.GetSize();
            Assert.Equal(0, size);
            entity.SetRootNode(new TreeNode());
            entity.RootNode.AppendChild(new TreeNode());
            entity.RootNode.ChildNodes[0].AppendChild(new TreeNode());
            entity.RootNode.AppendChild(new TreeNode());
            size = entity.GetSize();
            Assert.Equal(4, size);
        }
[ Fact ] public void TreeEntityBase_GetSize ( ) { MockGeneticAlgorithm algorithm = new MockGeneticAlgorithm { PopulationSeed = new MockPopulation ( ) , SelectionOperator = new MockSelectionOperator ( ) , FitnessEvaluator = new MockFitnessEvaluator ( ) , GeneticEntitySeed = new TestTreeEntity ( ) } ; TestTreeEntity entity = new TestTreeEntity ( ) ; entity . Initialize ( algorithm ) ; int size = entity . GetSize ( ) ; Assert . Equal ( 0 , size ) ; entity . SetRootNode ( new TreeNode ( ) ) ; entity . RootNode . AppendChild ( new TreeNode ( ) ) ; entity . RootNode . ChildNodes [ 0 ] . AppendChild ( new TreeNode ( ) ) ; entity . RootNode . AppendChild ( new TreeNode ( ) ) ; size = entity . GetSize ( ) ; Assert . Equal ( 4 , size ) ; }
Tests that the GetSize method works correctly.
Tests that the GetSize method works correctly .