예제 #1
0
        public CustomDialogResults ShowYesNoCancel(string message, string caption, CustomDialogIcons icon, CustomDialogResults defaultResult)
        {
            if (ShowYesNoCancelResponders.Count == 0)
            {
                throw new ApplicationException("TestMessageBoxService ShowYesNoCancel method expects a Func<CustomDialogResults> callback \r\ndelegate to be enqueued for each Show call");
            }

            ShowYesNoCancelRequests.Add(new MessageBoxRequest {
                Message = message, Caption = caption, Icon = icon, DefaultResult = defaultResult
            });

            return(ShowYesNoCancelResponders.Dequeue()());
        }
예제 #2
0
 /// <summary>
 /// Returns the next Dequeue ShowYesNoCancel response expected. See the tests for
 /// the Func callback expected values
 /// </summary>
 /// <param name="message">The message to be displayed.</param>
 /// <param name="icon">The icon to be displayed.</param>
 /// <returns>User selection.</returns>
 public CustomDialogResults ShowYesNoCancel(string message, CustomDialogIcons icon)
 {
     if (ShowYesNoCancelResponders.Count == 0)
     {
         throw new ApplicationException(
                   "TestMessageBoxService ShowYesNoCancel method expects a Func<CustomDialogResults> callback \r\n" +
                   "delegate to be enqueued for each Show call");
     }
     else
     {
         Func <CustomDialogResults> responder = ShowYesNoCancelResponders.Dequeue();
         return(responder());
     }
 }