public void ForwardCanExecuteChangedEvent() { bool canExecuteChangedCalled = false; TestCommand testCommand = new TestCommand(); CommandReference commandReference = new CommandReference { Command = testCommand }; commandReference.CanExecuteChanged += ((sender, eventArgs) => canExecuteChangedCalled = true); object canExecuteParameter = new object(); bool canExecute = commandReference.CanExecute(canExecuteParameter); Assert.IsTrue(canExecute); Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter); testCommand.CanExecuteValue = false; testCommand.FireCanExecuteChanged(); Assert.IsTrue(canExecuteChangedCalled); canExecuteParameter = new object(); canExecute = commandReference.CanExecute(canExecuteParameter); Assert.IsFalse(canExecute); Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter); commandReference.Command = null; }
public void CanExecuteShouldReturnFalseWhenEmpty() { CommandReference commandReference = new CommandReference(); bool canExecute = commandReference.CanExecute(null); Assert.IsFalse(canExecute); }
public void CanExecuteShouldReturnFalseWhenEmpty() { CommandReference commandReference = new CommandReference(); bool canExecute = commandReference.CanExecute(null); Assert.IsFalse(canExecute); }
public void ForwardCanExecuteChangedEvent() { bool canExecuteChangedCalled = false; TestCommand testCommand = new TestCommand(); CommandReference commandReference = new CommandReference { Command = testCommand }; commandReference.CanExecuteChanged += ((sender, eventArgs) => canExecuteChangedCalled = true); object canExecuteParameter = new object(); bool canExecute = commandReference.CanExecute(canExecuteParameter); Assert.IsTrue(canExecute); Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter); testCommand.CanExecuteValue = false; testCommand.FireCanExecuteChanged(); Assert.IsTrue(canExecuteChangedCalled); canExecuteParameter = new object(); canExecute = commandReference.CanExecute(canExecuteParameter); Assert.IsFalse(canExecute); Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter); commandReference.Command = null; }
public void ShouldExecuteReferencedCommand() { bool canExecuteChangedCalled = false; TestCommand testCommand = new TestCommand(); CommandReference commandReference = new CommandReference { Command = testCommand }; commandReference.CanExecuteChanged += ((sender, eventArgs) => canExecuteChangedCalled = true); object canExecuteParameter = new object(); bool canExecute = commandReference.CanExecute(canExecuteParameter); Assert.IsTrue(canExecute); Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter); object executeParameter = new object(); commandReference.Execute(executeParameter); Assert.AreSame(executeParameter, testCommand.ExecuteParameter); Assert.IsFalse(canExecuteChangedCalled); }
public void ShouldExecuteReferencedCommand() { bool canExecuteChangedCalled = false; TestCommand testCommand = new TestCommand(); CommandReference commandReference = new CommandReference { Command = testCommand }; commandReference.CanExecuteChanged += ((sender, eventArgs) => canExecuteChangedCalled = true); object canExecuteParameter = new object(); bool canExecute = commandReference.CanExecute(canExecuteParameter); Assert.IsTrue(canExecute); Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter); object executeParameter = new object(); commandReference.Execute(executeParameter); Assert.AreSame(executeParameter, testCommand.ExecuteParameter); Assert.IsFalse(canExecuteChangedCalled); }