src/GenFx.Components.Tests/MeanTreeSizeTest.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 MeanTreeSize_GetResultValue_NullPopulation()
        {
            GeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                SelectionOperator = new MockSelectionOperator(),
                FitnessEvaluator = new MockFitnessEvaluator(),
                GeneticEntitySeed = new TestTreeEntity(),
                PopulationSeed = new SimplePopulation(),
            };
            algorithm.Metrics.Add(new MeanTreeSize());
            MeanTreeSize target = new MeanTreeSize();
            target.Initialize(algorithm);
            Assert.Throws<ArgumentNullException>(() => target.GetResultValue(null));
        }
[ Fact ] public void MeanTreeSize_GetResultValue_NullPopulation ( ) { GeneticAlgorithm algorithm = new MockGeneticAlgorithm { SelectionOperator = new MockSelectionOperator ( ) , FitnessEvaluator = new MockFitnessEvaluator ( ) , GeneticEntitySeed = new TestTreeEntity ( ) , PopulationSeed = new SimplePopulation ( ) , } ; algorithm . Metrics . Add ( new MeanTreeSize ( ) ) ; MeanTreeSize target = new MeanTreeSize ( ) ; 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 .