public void ButtonClickCommand_Validate() { var buttons = new string[4] { "b1", "b2", "b3", "b4" }; var vm = new MultiChoiceMsgBoxViewModel("title", "errorText", buttons); MultiChoiceMsgBoxResult result = MultiChoiceMsgBoxResult.Cancel; vm.CloseDialog += (s, e) => { result = e; }; Assert.True(vm.ButtonClickCommand.CanExecute(null)); vm.ButtonClickCommand.Execute(MultiChoiceMsgBoxResult.Button3); Assert.True(MultiChoiceMsgBoxResult.Button3 == result); }
/// <summary> /// Invoked by the view model with the dialog result /// </summary> private void ViewModel_CloseDialog(object sender, MultiChoiceMsgBoxResult e) { SelectedAction = e; DialogResult = true; }