src/GenFx.Tests/GeneticAlgorithmTest.cs
/// <summary>
/// Tests that an exception is thrown when a cycle is detected while sorting metrics.
/// </summary>
Tests that an exception is thrown when a cycle is detected while sorting metrics.
Tests that an exception is thrown when a cycle is detected while sorting metrics .
[Fact]
        public async Task GeneticAlgorithm_InitializeAsync_SortMetrics_Cycle()
        {
            MockGeneticAlgorithm algorithm = new MockGeneticAlgorithm
            {
                SelectionOperator = new MockSelectionOperator(),
                FitnessEvaluator = new MockFitnessEvaluator(),
                PopulationSeed = new MockPopulation(),
                GeneticEntitySeed = new MockEntity()
            };
            algorithm.Metrics.AddRange(new Metric[]
            {
                new CycleMetric1(),
                new CycleMetric2(),
                new CycleMetric3(),
            });
            await Assert.ThrowsAsync<InvalidOperationException>(() => algorithm.InitializeAsync());
        }
[ Fact ] public async Task GeneticAlgorithm_InitializeAsync_SortMetrics_Cycle ( ) { MockGeneticAlgorithm algorithm = new MockGeneticAlgorithm { SelectionOperator = new MockSelectionOperator ( ) , FitnessEvaluator = new MockFitnessEvaluator ( ) , PopulationSeed = new MockPopulation ( ) , GeneticEntitySeed = new MockEntity ( ) } ; algorithm . Metrics . AddRange ( new Metric [ ] { new CycleMetric1 ( ) , new CycleMetric2 ( ) , new CycleMetric3 ( ) , } ) ; await Assert . ThrowsAsync < InvalidOperationException > ( ( ) => algorithm . InitializeAsync ( ) ) ; }
Tests that an exception is thrown when a cycle is detected while sorting metrics.
Tests that an exception is thrown when a cycle is detected while sorting metrics .