src/GenFx.Wpf.Tests/PopulationSelectorTest.cs
/// <summary>
/// Tests that the selected population is changed when the environment is removed.
/// </summary>
Tests that the selected population is changed when the environment is removed.
Tests that the selected population is changed when the environment is removed .
[StaFact]
        public void PopulationSelector_OnEnvironmentChanged_RemoveEnvironment()
        {
            PopulationSelector selector = new PopulationSelector();
            GeneticEnvironment environment = new GeneticEnvironment(Mock.Of<GeneticAlgorithm>());
            Population population = Mock.Of<Population>();
            environment.Populations.Add(population);
            selector.Environment = environment;
            selector.Environment = null;
            Assert.Null(selector.SelectedPopulation);
            Assert.Equal(-1, selector.SelectedPopulationIndex);
            environment.Populations.Add(Mock.Of<Population>());
            Assert.Null(selector.SelectedPopulation);
            Assert.Equal(-1, selector.SelectedPopulationIndex);
        }
[ StaFact ] public void PopulationSelector_OnEnvironmentChanged_RemoveEnvironment ( ) { PopulationSelector selector = new PopulationSelector ( ) ; GeneticEnvironment environment = new GeneticEnvironment ( Mock . Of < GeneticAlgorithm > ( ) ) ; Population population = Mock . Of < Population > ( ) ; environment . Populations . Add ( population ) ; selector . Environment = environment ; selector . Environment = null ; Assert . Null ( selector . SelectedPopulation ) ; Assert . Equal ( - 1 , selector . SelectedPopulationIndex ) ; environment . Populations . Add ( Mock . Of < Population > ( ) ) ; Assert . Null ( selector . SelectedPopulation ) ; Assert . Equal ( - 1 , selector . SelectedPopulationIndex ) ; }
Tests that the selected population is changed when the environment is removed.
Tests that the selected population is changed when the environment is removed .
// Verify the control doesn't respond to a population being added to removed environment