src/GenFx.Tests/GeneticEntityTest.cs
/// <summary>
/// Tests that the GetFitnessValue method works correctly.
/// </summary>
Tests that the GetFitnessValue method works correctly.
Tests that the GetFitnessValue method works correctly .
[Fact]
        public void Entity_GetFitnessValue()
        {
            GeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                PopulationSeed = new MockPopulation(),
                SelectionOperator = new MockSelectionOperator(),
                FitnessEvaluator = new MockFitnessEvaluator(),
                GeneticEntitySeed = new MockEntity()
            };
            MockEntity entity = new MockEntity();
            entity.Initialize(algorithm);
            PrivateObject accessor = new PrivateObject(entity, new PrivateType(typeof(GeneticEntity)));
            entity.ScaledFitnessValue = 12;
            accessor.SetField("rawFitnessValue", 10);
            Assert.Equal(entity.ScaledFitnessValue, entity.GetFitnessValue(FitnessType.Scaled));
            Assert.Equal(accessor.GetField("rawFitnessValue"), entity.GetFitnessValue(FitnessType.Raw));
        }
[ Fact ] public void Entity_GetFitnessValue ( ) { GeneticAlgorithm algorithm = new MockGeneticAlgorithm { PopulationSeed = new MockPopulation ( ) , SelectionOperator = new MockSelectionOperator ( ) , FitnessEvaluator = new MockFitnessEvaluator ( ) , GeneticEntitySeed = new MockEntity ( ) } ; MockEntity entity = new MockEntity ( ) ; entity . Initialize ( algorithm ) ; PrivateObject accessor = new PrivateObject ( entity , new PrivateType ( typeof ( GeneticEntity ) ) ) ; entity . ScaledFitnessValue = 12 ; accessor . SetField ( " " , 10 ) ; Assert . Equal ( entity . ScaledFitnessValue , entity . GetFitnessValue ( FitnessType . Scaled ) ) ; Assert . Equal ( accessor . GetField ( " " ) , entity . GetFitnessValue ( FitnessType . Raw ) ) ; }
Tests that the GetFitnessValue method works correctly.
Tests that the GetFitnessValue method works correctly .