public void BestMaximumFitnessEntityGetResultValue_NullPopulation()
        {
            GeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                SelectionOperator = new MockSelectionOperator(),
                GeneticEntitySeed = new MockEntity(),
                PopulationSeed    = new MockPopulation(),
                FitnessEvaluator  = new MockFitnessEvaluator(),
            };

            algorithm.Metrics.Add(new BestMaximumFitnessEntity());
            BestMaximumFitnessEntity target = new BestMaximumFitnessEntity();

            target.Initialize(algorithm);

            Assert.Throws <ArgumentNullException>(() => target.GetResultValue(null));
        }
        private static void VerifyGetResultValue(int multiplier, BestMaximumFitnessEntity metric, SimplePopulation population, GeneticAlgorithm algorithm, string expectedReturnVal)
        {
            for (int i = 0; i < 5; i++)
            {
                MockEntity entity = new MockEntity();
                entity.Initialize(algorithm);
                entity.ScaledFitnessValue = i * multiplier;
                entity.Identifier         = entity.ScaledFitnessValue.ToString();
                population.Entities.Add(entity);
            }

            for (int i = 10; i >= 5; i--)
            {
                MockEntity entity = new MockEntity();
                entity.Initialize(algorithm);
                entity.ScaledFitnessValue = i * multiplier;
                entity.Identifier         = entity.ScaledFitnessValue.ToString();
                population.Entities.Add(entity);
            }

            object representation = metric.GetResultValue(population);

            Assert.Equal(expectedReturnVal, representation.ToString());
        }