Actually, I want to test the MessageBox, means text displayed on messagebox is correct or not.How can I test the text on messagebox in Unit Testing?
Asked
Active
Viewed 94 times
0
-
stackoverflow.com/questions/4560542/how-to-suppress-a-message-box-while-unit-testing – Dhru 'soni Mar 27 '15 at 05:42
2 Answers
0
dont take a messagebox - the a "service". eg: Good or bad practice for Dialogs in wpf with MVVM?
here you can test the dialog viewmodel
-
Thank you all, for your response. Here i want to test the Text message on Message Box ("Data successfully saved."), Here I am using Telerik Testing Framework. In this frame work, first of all create Object for that class and then accessing the value. I am trying to create an object for Message Box class but, here object was not created because no Default constructors is not available for that class. I am creating Wrapper class for Message Box class and create an object for Wrapper class in unit test class now its working, But i want is there any different approaches are available or not? – Bhadram Mar 27 '15 at 09:17
0
Here i Used Content Dialog Box.
Button_Click Code
ContentDialog msg = new ContentDialog();
msg.Content = "Data Saved Successfully";
msg.ContentTemplate = Application.Current.Resources["ContentDialogContentTemplate"] as DataTemplate;
msg.PrimaryButtonText = CommonDisplayMessages.DisplayMessage_Yes;
await msg.ShowAsync();

Jayasri
- 237
- 1
- 11