/// <summary> /// Save the specified value with entry delay and ignore any warning dialogs /// </summary> /// <param name="context">the current test contest</param> /// <param name="userContext">the user context</param> /// <param name="control">the control to be updated</param> /// <param name="value">the value</param> /// <param name="ignoreAction">the name of the action, default is Yes</param> public static void SaveValueAndIgnoreWarning(TestContext context, UserContext userContext, ClientLogicalControl control, string value, string ignoreAction = "Yes") { var dialog = userContext.CatchDialog(() => SaveValueWithDelay(control, value)); if (dialog != null) { try { var action = dialog.Action(ignoreAction); if (action != null) { action.Invoke(); context.WriteLine("Dialog Caption: {0} Message: {1} was ignored with Action: {2} ", dialog.Caption, dialog.FindMessage(), ignoreAction); } } catch (InvalidOperationException) { context.WriteLine("Dialog Caption: {0} Message: {1} Action: {2} was not found.", dialog.Caption, dialog.FindMessage(), ignoreAction); throw; } } }
private void PostSalesOrder(UserContext userContext, ClientLogicalForm newSalesOrderPage) { ClientLogicalForm postConfirmationDialog; using (new TestTransaction(TestContext, "Post")) { postConfirmationDialog = newSalesOrderPage.Action("Post...").InvokeCatchDialog(); } if (postConfirmationDialog == null) { userContext.ValidateForm(newSalesOrderPage); Assert.Inconclusive("Post dialog can't be found"); } using (new TestTransaction(TestContext, "ConfirmShipAndInvoice")) { ClientLogicalForm dialog = userContext.CatchDialog(postConfirmationDialog.Action("OK").Invoke); if (dialog != null) { // after confiming the post we dont expect more dialogs Assert.Fail("Unexpected Dialog on Post - Caption: {0} Message: {1}", dialog.Caption, dialog.FindMessage()); } } }