src/GenFx.Wpf.Tests/PopulationSelectorTest.cs
/// <summary>
/// Tests that the selected population is set to null when the index is set greater than available index.
/// </summary>
Tests that the selected population is set to null when the index is set greater than available index.
Tests that the selected population is set to null when the index is set greater than available index .
[StaFact]
        public void PopulationSelector_SelectedPopulationIndexChanged_GreaterThanAllowed()
        {
            PopulationSelector selector = new PopulationSelector();
            GeneticEnvironment environment = new GeneticEnvironment(Mock.Of<GeneticAlgorithm>());
            Population population = Mock.Of<Population>();
            environment.Populations.Add(population);
            selector.Environment = environment;
            Assert.Same(population, selector.SelectedPopulation);
            selector.SelectedPopulationIndex = 1;
            Assert.Null(selector.SelectedPopulation);
        }
[ StaFact ] public void PopulationSelector_SelectedPopulationIndexChanged_GreaterThanAllowed ( ) { PopulationSelector selector = new PopulationSelector ( ) ; GeneticEnvironment environment = new GeneticEnvironment ( Mock . Of < GeneticAlgorithm > ( ) ) ; Population population = Mock . Of < Population > ( ) ; environment . Populations . Add ( population ) ; selector . Environment = environment ; Assert . Same ( population , selector . SelectedPopulation ) ; selector . SelectedPopulationIndex = 1 ; Assert . Null ( selector . SelectedPopulation ) ; }
Tests that the selected population is set to null when the index is set greater than available index.
Tests that the selected population is set to null when the index is set greater than available index .