private void YT_TextBox_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) { if (!(bool)e.NewValue) { BindingExpression binding = GetBindingExpression(TextBox.TextProperty); binding?.UpdateSource(); RoutedCommand rcmd = DisableCommand as RoutedCommand; if (rcmd != null) { if (rcmd.CanExecute(CommandParameter, CommandTarget)) { rcmd.Execute(CommandParameter, CommandTarget); } } else { if (DisableCommand != null) { if (DisableCommand.CanExecute(CommandParameter)) { DisableCommand.Execute(CommandParameter); } } } } }
public void IsExecutable() { var command = new DisableCommand(Mock.Of <IViewModel>(), Mock.Of <IBeamgunSettings>()); command.CanExecute(null).ShouldBeTrue(); }