public void CreateSetExceptionBreakCommandForAll() { // Arrange const int commandId = 3; const bool uncaught = false; const bool enabled = false; // Act var setExceptionBreakCommand = new SetExceptionBreakCommand(commandId, uncaught, enabled); // Assert Assert.AreEqual(commandId, setExceptionBreakCommand.Id); Assert.AreEqual( string.Format( "{{\"command\":\"setexceptionbreak\",\"seq\":{0},\"type\":\"request\",\"arguments\":{{\"type\":\"all\",\"enabled\":{1}}}}}", commandId, enabled.ToString().ToLower()), setExceptionBreakCommand.ToString()); }
private async Task SetExceptionBreakAsync(CancellationToken cancellationToken = new CancellationToken()) { // UNDONE Handle break on unhandled, once just my code is supported // Node has a catch all, so there are no uncaught exceptions // For now just break on all //var breakOnAllExceptions = _defaultExceptionTreatment == ExceptionHitTreatment.BreakAlways || _exceptionTreatments.Values.Any(value => value == ExceptionHitTreatment.BreakAlways); //var breakOnUncaughtExceptions = !all && (_defaultExceptionTreatment != ExceptionHitTreatment.BreakNever || _exceptionTreatments.Values.Any(value => value != ExceptionHitTreatment.BreakNever)); bool breakOnAllExceptions = _exceptionHandler.BreakOnAllExceptions; const bool breakOnUncaughtExceptions = false; if (HasExited) { return; } if (_breakOnAllExceptions != breakOnAllExceptions) { var setExceptionBreakCommand = new SetExceptionBreakCommand(CommandId, false, breakOnAllExceptions); await TrySendRequestAsync(setExceptionBreakCommand, cancellationToken).ConfigureAwait(false); _breakOnAllExceptions = breakOnAllExceptions; } if (_breakOnUncaughtExceptions != breakOnUncaughtExceptions) { var setExceptionBreakCommand = new SetExceptionBreakCommand(CommandId, true, breakOnUncaughtExceptions); await TrySendRequestAsync(setExceptionBreakCommand, cancellationToken).ConfigureAwait(false); _breakOnUncaughtExceptions = breakOnUncaughtExceptions; } }