public async Task InterruptRStatusTest() { var debuggerModeTracker = _exportProvider.GetExportedValue <TestDebuggerModeTracker>(); var command = new InterruptRCommand(_workflow, debuggerModeTracker); command.Should().BeInvisibleAndDisabled(); await _workflow.RSessions.TrySwitchBrokerAsync(nameof(RInteractiveWorkflowCommandTest)); using (await UIThreadHelper.Instance.Invoke(() => _workflow.GetOrCreateVisualComponentAsync())) { command.Should().BeVisibleAndDisabled(); using (var interaction = await _workflow.RSession.BeginInteractionAsync()) { var afterRequestTask = EventTaskSources.IRSession.AfterRequest.Create(_workflow.RSession); var task = interaction.RespondAsync("while(TRUE) {}"); await afterRequestTask; command.Should().BeVisibleAndEnabled(); debuggerModeTracker.IsInBreakMode = true; command.Should().BeVisibleAndDisabled(); debuggerModeTracker.IsInBreakMode = false; command.Should().BeVisibleAndEnabled(); await command.InvokeAsync(); command.Should().BeVisibleAndDisabled(); await task.Should().BeCanceledAsync(); } } command.Should().BeVisibleAndDisabled(); }
public async Task InterruptRStatusTest() { var command = new InterruptRCommand(_workflow, _debuggerModeTracker); command.Should().BeInvisibleAndDisabled(); using (await UIThreadHelper.Instance.Invoke(() => _workflow.GetOrCreateVisualComponent(_componentContainerFactory))) { command.Should().BeVisibleAndDisabled(); await _workflow.RSession.BeginEvaluationAsync(); command.Should().BeVisibleAndEnabled(); _debuggerModeTracker.OnModeChange(DBGMODE.DBGMODE_Break); command.Should().BeVisibleAndDisabled(); _debuggerModeTracker.OnModeChange(DBGMODE.DBGMODE_Run); command.Should().BeVisibleAndEnabled(); command.Invoke(); command.Should().BeVisibleAndDisabled(); } command.Should().BeVisibleAndDisabled(); }