public void GetExceptionHitTreatmentForUnknownError() {
            // Arrange
            var exceptionHandler = new ExceptionHandler();

            // Act
            ExceptionHitTreatment result = exceptionHandler.GetExceptionHitTreatment("Error(MY)");

            // Assert
            Assert.AreEqual(ExceptionHitTreatment.BreakNever, result);
        }
        public void SetSameDefaultExceptionHitTreatment() {
            // Arrange
            var exceptionHandler = new ExceptionHandler();

            // Act
            bool updated = exceptionHandler.SetDefaultExceptionHitTreatment(ExceptionHitTreatment.BreakNever);

            // Assert
            Assert.IsFalse(updated);
        }
        public void SetNewDefaultExceptionHitTreatment() {
            // Arrange
            var exceptionHandler = new ExceptionHandler();

            // Act
            bool updated = exceptionHandler.SetDefaultExceptionHitTreatment(ExceptionHitTreatment.BreakOnUnhandled);

            // Assert
            Assert.IsTrue(updated);
        }
        public void GetExceptionHitTreatmentForUnknownErrorAfterChangingDefaults() {
            // Arrange
            var exceptionHandler = new ExceptionHandler();
            const ExceptionHitTreatment newDefault = ExceptionHitTreatment.BreakAlways;

            // Act
            exceptionHandler.SetDefaultExceptionHitTreatment(newDefault);
            ExceptionHitTreatment result = exceptionHandler.GetExceptionHitTreatment("Error(MY)");

            // Assert
            Assert.AreEqual(newDefault, result);
        }
        private NodeDebugger() {
            _connection = new DebuggerConnection(new NetworkClientFactory());
            _connection.ConnectionClosed += OnConnectionClosed;

            _client = new DebuggerClient(_connection);
            _client.BreakpointEvent += OnBreakpointEvent;
            _client.CompileScriptEvent += OnCompileScriptEvent;
            _client.ExceptionEvent += OnExceptionEvent;

            _resultFactory = new EvaluationResultFactory();
            _exceptionHandler = new ExceptionHandler();
            _sourceMapper = new SourceMapper();
            _fileNameMapper = new LocalFileNameMapper();
        }
        public void SetSameExceptionTreatments() {
            // Arrange
            var exceptionHandler = new ExceptionHandler();
            const string exceptionName = "Error";
            const ExceptionHitTreatment newValue = ExceptionHitTreatment.BreakNever;
            ExceptionHitTreatment initial = exceptionHandler.GetExceptionHitTreatment(exceptionName);

            // Act
            bool updated = exceptionHandler.SetExceptionTreatments(new Dictionary<string, ExceptionHitTreatment> {
                { exceptionName, newValue }
            });
            ExceptionHitTreatment changed = exceptionHandler.GetExceptionHitTreatment(exceptionName);

            // Assert
            Assert.AreEqual(ExceptionHitTreatment.BreakNever, initial);
            Assert.IsFalse(updated);
            Assert.AreEqual(initial, changed);
            Assert.AreEqual(newValue, changed);
        }
        public void ResetExceptionTreatments() {
            // Arrange
            var exceptionHandler = new ExceptionHandler();
            exceptionHandler.SetExceptionTreatments(new Dictionary<string, ExceptionHitTreatment> {
                { "Node.js Exceptions", ExceptionHitTreatment.BreakAlways }
            });

            // Act
            bool updated = exceptionHandler.ResetExceptionTreatments();

            // Assert
            Assert.IsTrue(updated);
        }
        public void ClearExceptionTreatments() {
            // Arrange
            var exceptionHandler = new ExceptionHandler();
            const string exceptionName = "SyntaxError";
            exceptionHandler.SetExceptionTreatments(new Dictionary<string, ExceptionHitTreatment> {
                { exceptionName, ExceptionHitTreatment.BreakAlways }
            });
            ExceptionHitTreatment initial = exceptionHandler.GetExceptionHitTreatment(exceptionName);

            // Act
            bool updated = exceptionHandler.ClearExceptionTreatments(new Dictionary<string, ExceptionHitTreatment> {
                { exceptionName, ExceptionHitTreatment.BreakOnUnhandled }
            });
            ExceptionHitTreatment changed = exceptionHandler.GetExceptionHitTreatment(exceptionName);

            // Assert
            Assert.AreEqual(ExceptionHitTreatment.BreakAlways, initial);
            Assert.IsTrue(updated);
            Assert.AreEqual(ExceptionHitTreatment.BreakNever, changed);
        }