public void DispatchCommandDoesNotIncludeInactiveRegisteredCommandInVoting() { CompositeCommand activeAwareCommand = new CompositeCommand(true); MockActiveAwareCommand command = new MockActiveAwareCommand(); activeAwareCommand.RegisterCommand(command); command.IsValid = true; command.IsActive = false; Assert.False(activeAwareCommand.CanExecute(null), "Registered Click is inactive so should not participate in CanExecute vote"); command.IsActive = true; Assert.True(activeAwareCommand.CanExecute(null)); command.IsValid = false; Assert.False(activeAwareCommand.CanExecute(null)); }
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.True(activeAwareCommand.CanExecute(null)); }
public void UnregisterCommandDisconnectsIsActiveChangedDelegate() { CompositeCommand activeAwareCommand = new CompositeCommand(true); MockActiveAwareCommand commandOne = new MockActiveAwareCommand() { IsActive = true, IsValid = true }; MockActiveAwareCommand commandTwo = new MockActiveAwareCommand() { IsActive = false, IsValid = false }; activeAwareCommand.RegisterCommand(commandOne); activeAwareCommand.RegisterCommand(commandTwo); Assert.True(activeAwareCommand.CanExecute(null)); activeAwareCommand.UnregisterCommand(commandOne); Assert.False(activeAwareCommand.CanExecute(null)); }