public CanExecute ( object parameter ) : bool | ||
parameter | object | Data used by the command.
/// If the command does not require data to be passed, this object can be set to |
리턴 | bool |
public void DispatchCommandShouldIgnoreInactiveCommandsInCanExecuteVote() { CompositeCommand activeAwareCommand = new CompositeCommand(true); MockActiveAwareCommand commandOne = new MockActiveAwareCommand() { IsActive = false, IsValid = false }; MockActiveAwareCommand commandTwo = new MockActiveAwareCommand() { IsActive = true, IsValid = true }; activeAwareCommand.RegisterCommand(commandOne); activeAwareCommand.RegisterCommand(commandTwo); Assert.IsTrue(activeAwareCommand.CanExecute(null)); }
public void DispatchCommandDoesNotIncludeInactiveRegisteredCommandInVoting() { CompositeCommand activeAwareCommand = new CompositeCommand(true); MockActiveAwareCommand command = new MockActiveAwareCommand(); activeAwareCommand.RegisterCommand(command); command.IsValid = true; command.IsActive = false; Assert.IsFalse(activeAwareCommand.CanExecute(null), "Registered Click is inactive so should not participate in CanExecute vote"); command.IsActive = true; Assert.IsTrue(activeAwareCommand.CanExecute(null)); command.IsValid = false; Assert.IsFalse(activeAwareCommand.CanExecute(null)); }