private static bool ExecuteWithExceptionHandling(Action action, TestContext testContext) { bool result = false; try { action.Invoke(); result = true; } catch (Exception ex) { testContext.SetError(ex); } return result; }