src/GenFx.Components.Tests/BestMaximumFitnessTest.cs
/// <summary>
/// Tests that an exception will be thrown when a null population1 is passed to <see cref="BestMaximumFitness.GetResultValue"/>.
/// </summary>
Tests that an exception will be thrown when a null population1 is passed to .
Tests that an exception will be thrown when a null population1 is passed to .
[Fact]
        public void BestMaximumFitness_GetResultValue_NullPopulation()
        {
            GeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                SelectionOperator = new MockSelectionOperator(),
                GeneticEntitySeed = new MockEntity(),
                PopulationSeed = new MockPopulation(),
                FitnessEvaluator = new MockFitnessEvaluator(),
            };
            algorithm.Metrics.Add(new BestMaximumFitness());
            BestMaximumFitness target = new BestMaximumFitness();
            target.Initialize(algorithm);
            Assert.Throws<ArgumentNullException>(() => target.GetResultValue(null));
        }
[ Fact ] public void BestMaximumFitness_GetResultValue_NullPopulation ( ) { GeneticAlgorithm algorithm = new MockGeneticAlgorithm { SelectionOperator = new MockSelectionOperator ( ) , GeneticEntitySeed = new MockEntity ( ) , PopulationSeed = new MockPopulation ( ) , FitnessEvaluator = new MockFitnessEvaluator ( ) , } ; algorithm . Metrics . Add ( new BestMaximumFitness ( ) ) ; BestMaximumFitness target = new BestMaximumFitness ( ) ; target . Initialize ( algorithm ) ; Assert . Throws < ArgumentNullException > ( ( ) => target . GetResultValue ( null ) ) ; }
Tests that an exception will be thrown when a null population1 is passed to .
Tests that an exception will be thrown when a null population1 is passed to .