src/GenFx.Components.Tests/BoltzmannSelectionOperatorTest.cs
/// <summary>
/// Tests that the Select method correctly returns a GeneticEntity.
/// </summary>
Tests that the Select method correctly returns a GeneticEntity.
Tests that the Select method correctly returns a GeneticEntity .
[Fact]
        public void BoltzmannSelectionOperator_Select()
        {
            double initialTemp = 10;
            GeneticAlgorithm algorithm = GetMockAlgorithm(initialTemp);
            FakeBoltzmannSelectionOperator op = (FakeBoltzmannSelectionOperator)algorithm.SelectionOperator;
            op.Initialize(algorithm);
            MockPopulation population = new MockPopulation();
            population.Initialize(algorithm);
            MockEntity entity1 = new MockEntity();
            entity1.Initialize(algorithm);
            population.Entities.Add(entity1);
            MockEntity entity2 = new MockEntity();
            entity2.Initialize(algorithm);
            population.Entities.Add(entity2);
            IEnumerable<GeneticEntity> entities = op.SelectEntities(2, population);
            Assert.NotNull(entities);
            Assert.True(entities.Count() > 0, "An entity should have been selected.");
        }
[ Fact ] public void BoltzmannSelectionOperator_Select ( ) { double initialTemp = 10 ; GeneticAlgorithm algorithm = GetMockAlgorithm ( initialTemp ) ; FakeBoltzmannSelectionOperator op = ( FakeBoltzmannSelectionOperator ) algorithm . SelectionOperator ; op . Initialize ( algorithm ) ; MockPopulation population = new MockPopulation ( ) ; population . Initialize ( algorithm ) ; MockEntity entity1 = new MockEntity ( ) ; entity1 . Initialize ( algorithm ) ; population . Entities . Add ( entity1 ) ; MockEntity entity2 = new MockEntity ( ) ; entity2 . Initialize ( algorithm ) ; population . Entities . Add ( entity2 ) ; IEnumerable < GeneticEntity > entities = op . SelectEntities ( 2 , population ) ; Assert . NotNull ( entities ) ; Assert . True ( entities . Count ( ) > 0 , " " ) ; }
Tests that the Select method correctly returns a GeneticEntity.
Tests that the Select method correctly returns a GeneticEntity .