src/GenFx.Tests/GeneticEntityTest.cs
/// <summary>
/// Tests that the EvaluateFitness method works correctly.
/// </summary>
Tests that the EvaluateFitness method works correctly.
Tests that the EvaluateFitness method works correctly .
[Fact]
        public async Task Entity_EvaluateFitness_Async()
        {
            GeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                PopulationSeed = new MockPopulation(),
                SelectionOperator = new MockSelectionOperator(),
                GeneticEntitySeed = new MockEntity(),
                FitnessEvaluator = new MockFitnessEvaluator(),
            };
            algorithm.FitnessEvaluator = new MockFitnessEvaluator();
            algorithm.FitnessEvaluator.Initialize(algorithm);
            MockEntity entity = new MockEntity();
            entity.Initialize(algorithm);
            entity.Identifier = "123";
            await entity.EvaluateFitnessAsync();
            Assert.Equal((double)123, entity.RawFitnessValue);
            Assert.Equal((double)123, entity.ScaledFitnessValue);
        }
[ Fact ] public async Task Entity_EvaluateFitness_Async ( ) { GeneticAlgorithm algorithm = new MockGeneticAlgorithm { PopulationSeed = new MockPopulation ( ) , SelectionOperator = new MockSelectionOperator ( ) , GeneticEntitySeed = new MockEntity ( ) , FitnessEvaluator = new MockFitnessEvaluator ( ) , } ; algorithm . FitnessEvaluator = new MockFitnessEvaluator ( ) ; algorithm . FitnessEvaluator . Initialize ( algorithm ) ; MockEntity entity = new MockEntity ( ) ; entity . Initialize ( algorithm ) ; entity . Identifier = " " ; await entity . EvaluateFitnessAsync ( ) ; Assert . Equal ( ( double ) 123 , entity . RawFitnessValue ) ; Assert . Equal ( ( double ) 123 , entity . ScaledFitnessValue ) ; }
Tests that the EvaluateFitness method works correctly.
Tests that the EvaluateFitness method works correctly .