src/GenFx.Components.Tests/GenerationalTerminatorTest.cs
/// <summary>
/// Tests that the IsComplete method works correctly.
/// </summary>
Tests that the IsComplete method works correctly.
Tests that the IsComplete method works correctly .
[Fact]
        public void GenerationalTerminator_IsComplete()
        {
            int finalGeneration = 10;
            GeneticAlgorithm algorithm = GetAlgorithm(finalGeneration);
            PrivateObject accessor = new PrivateObject(algorithm, new PrivateType(typeof(GeneticAlgorithm)));
            GenerationalTerminator terminator = (GenerationalTerminator)algorithm.Terminator;
            terminator.Initialize(algorithm);
            Assert.False(terminator.IsComplete(), "Should not be complete at generation 0.");
            accessor.SetField("currentGeneration", (int)accessor.GetField("currentGeneration") + 1);
            Assert.False(terminator.IsComplete(), "Should not be complete at generation 1.");
            accessor.SetField("currentGeneration", finalGeneration);
            Assert.True(terminator.IsComplete(), "Should be complete.");
        }
[ Fact ] public void GenerationalTerminator_IsComplete ( ) { int finalGeneration = 10 ; GeneticAlgorithm algorithm = GetAlgorithm ( finalGeneration ) ; PrivateObject accessor = new PrivateObject ( algorithm , new PrivateType ( typeof ( GeneticAlgorithm ) ) ) ; GenerationalTerminator terminator = ( GenerationalTerminator ) algorithm . Terminator ; terminator . Initialize ( algorithm ) ; Assert . False ( terminator . IsComplete ( ) , " " ) ; accessor . SetField ( " " , ( int ) accessor . GetField ( " " ) + 1 ) ; Assert . False ( terminator . IsComplete ( ) , " " ) ; accessor . SetField ( " " , finalGeneration ) ; Assert . True ( terminator . IsComplete ( ) , " " ) ; }
Tests that the IsComplete method works correctly.
Tests that the IsComplete method works correctly .