src/GenFx.Tests/SelectionOperatorTest.cs
/// <summary>
/// Tests that the Select method works correctly.
/// </summary>
Tests that the Select method works correctly.
Tests that the Select method works correctly .
[Fact]
        public void SelectionOperator_Select()
        {
            GeneticAlgorithm algorithm = GetAlgorithm();
            MockSelectionOperator op = new MockSelectionOperator();
            op.Initialize(algorithm);
            MockPopulation population = new MockPopulation();
            population.Initialize(algorithm);
            GeneticEntity entity1 = new MockEntity();
            entity1.Initialize(algorithm);
            GeneticEntity entity2 = new MockEntity();
            entity2.Initialize(algorithm);
            population.Entities.Add(entity1);
            population.Entities.Add(entity2);
            IList<GeneticEntity> selectedEntities = op.SelectEntities(1, population);
            Assert.Same(entity1, selectedEntities[0]);
            Assert.Equal(1, op.DoSelectCallCount);
        }
[ Fact ] public void SelectionOperator_Select ( ) { GeneticAlgorithm algorithm = GetAlgorithm ( ) ; MockSelectionOperator op = new MockSelectionOperator ( ) ; op . Initialize ( algorithm ) ; MockPopulation population = new MockPopulation ( ) ; population . Initialize ( algorithm ) ; GeneticEntity entity1 = new MockEntity ( ) ; entity1 . Initialize ( algorithm ) ; GeneticEntity entity2 = new MockEntity ( ) ; entity2 . Initialize ( algorithm ) ; population . Entities . Add ( entity1 ) ; population . Entities . Add ( entity2 ) ; IList < GeneticEntity > selectedEntities = op . SelectEntities ( 1 , population ) ; Assert . Same ( entity1 , selectedEntities [ 0 ] ) ; Assert . Equal ( 1 , op . DoSelectCallCount ) ; }
Tests that the Select method works correctly.
Tests that the Select method works correctly .