Esempio n. 1
0
        public void Show()
        {
            // Arrange
            var settings       = new MessageBoxSettings();
            var messageBoxShow = new Mock <IMessageBoxShow>();
            var dialog         = new MessageBoxWrapper(messageBoxShow.Object, settings);

            settings.Button         = MessageBoxButton.YesNoCancel;
            settings.Caption        = "Some caption";
            settings.DefaultResult  = MessageBoxResult.Yes;
            settings.Icon           = MessageBoxImage.Warning;
            settings.MessageBoxText = "Some message box text";
            settings.Options        = MessageBoxOptions.RightAlign;

            var owner = new Window();

            messageBoxShow
            .Setup(mock =>
                   mock.Show(
                       owner,
                       settings.MessageBoxText,
                       settings.Caption,
                       settings.Button,
                       settings.Icon,
                       settings.DefaultResult,
                       settings.Options))
            .Returns(MessageBoxResult.Cancel);

            // Act
            dialog.Show(owner);

            // Assert
            messageBoxShow.VerifyAll();
        }
 public void SetUp()
 {
     settings       = new MessageBoxSettings();
     messageBoxShow = new Mock <IMessageBoxShow>();
     dialog         = new MessageBoxWrapper(messageBoxShow.Object, settings);
 }