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 ButtonClickExecutesCommand()
        {
            var mockCommand = new MockCommand();
            MockClickableButton button = new MockClickableButton();
            button.SetValue(CommandProperties.CommandProperty, mockCommand);
            Assert.IsFalse(mockCommand.ExecuteCalled);

            button.InvokeClick();

            Assert.IsTrue(mockCommand.ExecuteCalled);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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 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);
        }
Esempio n. 6
0
        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);
        }