src/GenFx.Tests/PopulationTest.cs
/// <summary>
/// Tests that the Initialize method works correctly.
/// </summary>
Tests that the Initialize method works correctly.
Tests that the Initialize method works correctly .
[Fact]
        public async Task Population_Initialize_Async()
        {
            GeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                FitnessEvaluator = new MockFitnessEvaluator(),
                SelectionOperator = new MockSelectionOperator(),
                GeneticEntitySeed = new MockEntity
                {
                    TestProperty = 3
                },
                PopulationSeed = new MockPopulation
                {
                    MinimumPopulationSize = 10
                }
            };
            algorithm.GeneticEntitySeed.Initialize(algorithm);
            MockPopulation population = new MockPopulation();
            population.Initialize(algorithm);
            await population.InitializeAsync();
            Assert.Equal(algorithm.PopulationSeed.MinimumPopulationSize, population.Entities.Count);
            Assert.Equal(3, ((MockEntity)population.Entities[0]).TestProperty);
        }
[ Fact ] public async Task Population_Initialize_Async ( ) { GeneticAlgorithm algorithm = new MockGeneticAlgorithm { FitnessEvaluator = new MockFitnessEvaluator ( ) , SelectionOperator = new MockSelectionOperator ( ) , GeneticEntitySeed = new MockEntity { TestProperty = 3 } , PopulationSeed = new MockPopulation { MinimumPopulationSize = 10 } } ; algorithm . GeneticEntitySeed . Initialize ( algorithm ) ; MockPopulation population = new MockPopulation ( ) ; population . Initialize ( algorithm ) ; await population . InitializeAsync ( ) ; Assert . Equal ( algorithm . PopulationSeed . MinimumPopulationSize , population . Entities . Count ) ; Assert . Equal ( 3 , ( ( MockEntity ) population . Entities [ 0 ] ) . TestProperty ) ; }
Tests that the Initialize method works correctly.
Tests that the Initialize method works correctly .