src/GenFx.Wpf.Tests/ExecutionPanelViewModelTest.cs
/// <summary>
/// Tests that the <see cref="ExecutionPanelViewModel.StepExecutionAsync"/> method works correctly.
/// </summary>
Tests that the  method works correctly.
Tests that the method works correctly .
[Fact]
        public void ExecutionPanelViewModel_StepExecutionAsync_FromPaused()
        {
            GeneticAlgorithm algorithm = CreateTestAlgorithm(true);
            ExecutionContext context = new ExecutionContext(algorithm)
            {
                ExecutionState = ExecutionState.Idle
            };
            using (ExecutionPanelViewModel viewModel = new ExecutionPanelViewModel(context))
            {
                Task task = Task.Run(async () => await viewModel.StepExecutionAsync());
                TestHelper.WaitForResult(ExecutionState.Paused, () => context.ExecutionState);
                GeneticEnvironment environment = algorithm.Environment;
                TestHelper.WaitForPropertyChanged(context,
                    new[]
                    {
                        new Tuple<string, object>(nameof(context.ExecutionState), ExecutionState.Running),
                        new Tuple<string, object>(nameof(context.ExecutionState), ExecutionState.Paused)
                    },
                    () => task = Task.Run(async () => await viewModel.StepExecutionAsync()));
                Assert.Same(environment, algorithm.Environment);
                Assert.True(task.IsCompleted);
            }
        }
[ Fact ] public void ExecutionPanelViewModel_StepExecutionAsync_FromPaused ( ) { GeneticAlgorithm algorithm = CreateTestAlgorithm ( true ) ; ExecutionContext context = new ExecutionContext ( algorithm ) { ExecutionState = ExecutionState . Idle } ; using ( ExecutionPanelViewModel viewModel = new ExecutionPanelViewModel ( context ) ) { Task task = Task . Run ( async ( ) => await viewModel . StepExecutionAsync ( ) ) ; TestHelper . WaitForResult ( ExecutionState . Paused , ( ) => context . ExecutionState ) ; GeneticEnvironment environment = algorithm . Environment ; TestHelper . WaitForPropertyChanged ( context , new [ ] { new Tuple < string , object > ( nameof ( context . ExecutionState ) , ExecutionState . Running ) , new Tuple < string , object > ( nameof ( context . ExecutionState ) , ExecutionState . Paused ) } , ( ) => task = Task . Run ( async ( ) => await viewModel . StepExecutionAsync ( ) ) ) ; Assert . Same ( environment , algorithm . Environment ) ; Assert . True ( task . IsCompleted ) ; } }
Tests that the  method works correctly.
Tests that the method works correctly .
// Wait for the algorithm to finish execution // Verify InitializeAsync was not called