public void DeattachingFromCommandDoesNotInvokeItWhenClickingIt() { var mockCommand = new MockCommand(); MockClickableButton button = new MockClickableButton(); button.SetValue(CommandProperties.CommandProperty, mockCommand); button.SetValue(CommandProperties.CommandProperty, null); button.InvokeClick(); Assert.IsFalse(mockCommand.ExecuteCalled); }
public void DeattachingFromCommandDoesNotInvokeItWhenClickingIt() { var mockCommand = new MockCommand(); MockClickableButton button = new MockClickableButton(); button.SetValue(CommandProperties.CommandProperty, mockCommand); button.SetValue(CommandProperties.CommandProperty, null); button.InvokeClick(); Assert.IsFalse(mockCommand.ExecuteCalled); }
public void CommandParameterIsPassedToCommandInvocation() { var mockCommand = new MockCommand(); MockClickableButton button = new MockClickableButton(); button.SetValue(CommandProperties.CommandProperty, mockCommand); object parameter = new object(); button.SetValue(CommandProperties.CommandParameterProperty, parameter); button.InvokeClick(); Assert.IsNotNull(mockCommand.ExecuteArgumentParameter); Assert.AreEqual(parameter, mockCommand.ExecuteArgumentParameter); }
public void CommandParameterIsPassedToCommandInvocation() { var mockCommand = new MockCommand(); MockClickableButton button = new MockClickableButton(); button.SetValue(CommandProperties.CommandProperty, mockCommand); object parameter = new object(); button.SetValue(CommandProperties.CommandParameterProperty, parameter); button.InvokeClick(); Assert.IsNotNull(mockCommand.ExecuteArgumentParameter); Assert.AreEqual(parameter, mockCommand.ExecuteArgumentParameter); }
public void ButtonClickExecutesCommand() { var mockCommand = new MockCommand(); MockClickableButton button = new MockClickableButton(); button.SetValue(CommandProperties.CommandProperty, mockCommand); Assert.IsFalse(mockCommand.ExecuteCalled); button.InvokeClick(); Assert.IsTrue(mockCommand.ExecuteCalled); }
public void ButtonClickExecutesCommand() { var mockCommand = new MockCommand(); MockClickableButton button = new MockClickableButton(); button.SetValue(CommandProperties.CommandProperty, mockCommand); Assert.IsFalse(mockCommand.ExecuteCalled); button.InvokeClick(); Assert.IsTrue(mockCommand.ExecuteCalled); }