public void CompositeCommandCanExecuteConditionTest() { CompositeCommand = new CompositeCommandBehavior(); Assert.AreEqual(CompositeCommandExecuteCondition.AllCommandsCanBeExecuted, CompositeCommand.CanExecuteCondition); var firstCommand = new MockCommand(1) { IsEnabled = false }; var secondCommand = new MockCommand(2); CompositeCommand.Commands.Add(new CommandItem() { Command = firstCommand, CommandParameter = 11 }); CompositeCommand.Commands.Add(new CommandItem() { Command = secondCommand, CommandParameter = 12 }); Assert.IsFalse(CompositeCommand.CompositeCommand.CanExecute(null)); CompositeCommand.CompositeCommand.Execute(null); Assert.IsNull(firstCommand.CommandExecuteResult); Assert.IsNull(secondCommand.CommandExecuteResult); CompositeCommand.CanExecuteCondition = CompositeCommandExecuteCondition.AnyCommandCanBeExecuted; Assert.IsTrue(CompositeCommand.CompositeCommand.CanExecute(null)); CompositeCommand.CompositeCommand.Execute(null); Assert.IsNull(firstCommand.CommandExecuteResult); Assert.AreEqual(2, secondCommand.CommandExecuteResult); secondCommand.Reset(); secondCommand.IsEnabled = false; Assert.IsFalse(CompositeCommand.CompositeCommand.CanExecute(null)); CompositeCommand.CompositeCommand.Execute(null); Assert.IsNull(firstCommand.CommandExecuteResult); Assert.IsNull(secondCommand.CommandExecuteResult); }