src/GenFx.Tests/MetricTest.cs
/// <summary>
/// Tests that the constructor correctly initializes the state.
/// </summary>
Tests that the constructor correctly initializes the state.
Tests that the constructor correctly initializes the state .
[Fact]
        public void Metric_Ctor()
        {
            GeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                GeneticEntitySeed = new MockEntity(),
                PopulationSeed = new MockPopulation(),
                SelectionOperator = new MockSelectionOperator(),
                FitnessEvaluator = new MockFitnessEvaluator(),
            };
            algorithm.Metrics.Add(new MockMetric());
            Metric metric = new MockMetric();
            metric.Initialize(algorithm);
            PrivateObject accessor = new PrivateObject(metric, new PrivateType(typeof(Metric)));
            Assert.Same(accessor.GetProperty("Algorithm"), algorithm);
        }
[ Fact ] public void Metric_Ctor ( ) { GeneticAlgorithm algorithm = new MockGeneticAlgorithm { GeneticEntitySeed = new MockEntity ( ) , PopulationSeed = new MockPopulation ( ) , SelectionOperator = new MockSelectionOperator ( ) , FitnessEvaluator = new MockFitnessEvaluator ( ) , } ; algorithm . Metrics . Add ( new MockMetric ( ) ) ; Metric metric = new MockMetric ( ) ; metric . Initialize ( algorithm ) ; PrivateObject accessor = new PrivateObject ( metric , new PrivateType ( typeof ( Metric ) ) ) ; Assert . Same ( accessor . GetProperty ( " " ) , algorithm ) ; }
Tests that the constructor correctly initializes the state.
Tests that the constructor correctly initializes the state .