src/GenFx.Components.Tests/MaximumFitnessTest.cs
/// <summary>
/// Tests that an exception is thrown when a null population is passed.
/// </summary>
Tests that an exception is thrown when a null population is passed.
Tests that an exception is thrown when a null population is passed .
[Fact]
        public void MaximumFitness_GetResultValue_NullPopulation()
        {
            MockGeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                SelectionOperator = new MockSelectionOperator(),
                GeneticEntitySeed = new MockEntity(),
                PopulationSeed = new SimplePopulation(),
                FitnessEvaluator = new MockFitnessEvaluator(),
            };
            algorithm.Metrics.Add(new MaximumFitness());
            MaximumFitness target = new MaximumFitness();
            target.Initialize(algorithm);
            Assert.Throws<ArgumentNullException>(() => target.GetResultValue(null));
        }
[ Fact ] public void MaximumFitness_GetResultValue_NullPopulation ( ) { MockGeneticAlgorithm algorithm = new MockGeneticAlgorithm { SelectionOperator = new MockSelectionOperator ( ) , GeneticEntitySeed = new MockEntity ( ) , PopulationSeed = new SimplePopulation ( ) , FitnessEvaluator = new MockFitnessEvaluator ( ) , } ; algorithm . Metrics . Add ( new MaximumFitness ( ) ) ; MaximumFitness target = new MaximumFitness ( ) ; target . Initialize ( algorithm ) ; Assert . Throws < ArgumentNullException > ( ( ) => target . GetResultValue ( null ) ) ; }
Tests that an exception is thrown when a null population is passed.
Tests that an exception is thrown when a null population is passed .