public void CreateSuspendCommand() { // Arrange const int commandId = 3; // Act var suspendCommand = new SuspendCommand(commandId); // Assert Assert.AreEqual(commandId, suspendCommand.Id); Assert.AreEqual( string.Format("{{\"command\":\"suspend\",\"seq\":{0},\"type\":\"request\",\"arguments\":null}}", commandId), suspendCommand.ToString()); }
/// <summary> /// Breaks into the process. /// </summary> public async Task BreakAllAsync() { DebugWriteCommand("BreakAll"); var tokenSource = new CancellationTokenSource(_timeout); var suspendCommand = new SuspendCommand(CommandId); await TrySendRequestAsync(suspendCommand, tokenSource.Token).ConfigureAwait(false); // Handle success // We need to get the backtrace before we break, so we request the backtrace // and follow up with firing the appropriate event for the break tokenSource = new CancellationTokenSource(_timeout); bool running = await PerformBacktraceAsync(tokenSource.Token).ConfigureAwait(false); Debug.Assert(!running); // Fallback to firing step complete event EventHandler<ThreadEventArgs> asyncBreakComplete = AsyncBreakComplete; if (asyncBreakComplete != null) { asyncBreakComplete(this, new ThreadEventArgs(MainThread)); } }