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 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 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); }