src/GenFx.Wpf.Tests/ExecutionPanelTest.cs
/// <summary>
/// Tests that the <see cref="ExecutionPanel.StepExecutionCommand"/> works correctly.
/// </summary>
Tests that the  works correctly.
Tests that the works correctly .
[StaFact]
        public void ExecutionPanel_StepExecutionCommand_Execute()
        {
            using SemaphoreSlim algorithmPausedSemaphore = new SemaphoreSlim(0);
            Dispatcher.CurrentDispatcher.Invoke(async () =>
            {
                ExecutionPanel panel = new ExecutionPanel
                {
                    ExecutionContext = new ExecutionContext(CreateTestAlgorithm(true))
                };
                using var algorithmPausedObservable = Observable
                    .FromEventPattern<PropertyChangedEventHandler, PropertyChangedEventArgs>(
                        ev => panel.ExecutionContext.PropertyChanged += ev,
                        ev => panel.ExecutionContext.PropertyChanged -= ev)
                    .Where(eventPattern => ((ExecutionContext)eventPattern.Sender).ExecutionState == ExecutionState.Paused)
                    .Subscribe(_ => algorithmPausedSemaphore.Release());
                await panel.ViewModel.StepExecutionAsync();
            });
            DispatcherHelper.DoEvents();
            Assert.True(algorithmPausedSemaphore.Wait(TimeSpan.FromSeconds(10)));
        }
[ StaFact ] public void ExecutionPanel_StepExecutionCommand_Execute ( ) { using SemaphoreSlim algorithmPausedSemaphore = new SemaphoreSlim ( 0 ) ; Dispatcher . CurrentDispatcher . Invoke ( async ( ) => { ExecutionPanel panel = new ExecutionPanel { ExecutionContext = new ExecutionContext ( CreateTestAlgorithm ( true ) ) } ; using var algorithmPausedObservable = Observable . FromEventPattern < PropertyChangedEventHandler , PropertyChangedEventArgs > ( ev => panel . ExecutionContext . PropertyChanged += ev , ev => panel . ExecutionContext . PropertyChanged -= ev ) . Where ( eventPattern => ( ( ExecutionContext ) eventPattern . Sender ) . ExecutionState == ExecutionState . Paused ) . Subscribe ( _ => algorithmPausedSemaphore . Release ( ) ) ; await panel . ViewModel . StepExecutionAsync ( ) ; } ) ; DispatcherHelper . DoEvents ( ) ; Assert . True ( algorithmPausedSemaphore . Wait ( TimeSpan . FromSeconds ( 10 ) ) ) ; }
Tests that the  works correctly.
Tests that the works correctly .