public void ShouldExecuteWithCommandParameter() { var clickableObject = new MockClickableObject(); var command = new MockCommand(); var parameter = new object(); Click.SetCommand(clickableObject, command); Click.SetCommandParameter(clickableObject, parameter); Assert.IsNull(command.ExecuteParameter); clickableObject.RaiseClick(); Assert.IsTrue(command.ExecuteCalled); Assert.IsNotNull(command.ExecuteParameter); Assert.AreSame(parameter, command.ExecuteParameter); }
public void ShouldCallCanExecuteOnParameterChange() { var clickableObject = new MockClickableObject(); var command = new MockCommand(); var parameter = new object(); Click.SetCommand(clickableObject, command); Assert.IsNull(command.CanExecuteParameter); Assert.IsTrue(clickableObject.IsEnabled); command.CanExecuteReturnValue = false; Click.SetCommandParameter(clickableObject, parameter); Assert.IsNotNull(command.CanExecuteParameter); Assert.AreSame(parameter, command.CanExecuteParameter); Assert.IsFalse(clickableObject.IsEnabled); }