public void ExecuteUsesParameterWhenCommandParameterNotSet()
        {
            var         targetUIElement = new UIElement();
            var         target          = new TestableCommandBehaviorBase(targetUIElement);
            TestCommand testCommand     = new TestCommand();

            target.Command = testCommand;

            target.ExecuteCommand("testparam");

            Assert.Equal("testparam", testCommand.ExecuteCalledWithParameter);
        }
        public void CommandBehaviorBaseEnablesUIElement()
        {
            var targetUIElement = new UIElement();

            targetUIElement.IsEnabled = false;

            var         target      = new TestableCommandBehaviorBase(targetUIElement);
            TestCommand testCommand = new TestCommand();

            target.Command = testCommand;
            target.ExecuteCommand(null);

            Assert.True(targetUIElement.IsEnabled);
        }
        public void CommandBehaviorBaseDisablesUIElement()
        {
            var targetUIElement = new UIElement();

            targetUIElement.IsEnabled = true;

            var         target      = new TestableCommandBehaviorBase(targetUIElement);
            TestCommand testCommand = new TestCommand();

            testCommand.CanExecuteResult = false;
            target.Command = testCommand;
            target.ExecuteCommand(null);

            Assert.False(targetUIElement.IsEnabled);
        }
        public void WhenAutoEnableIsFalse_ThenDisabledUIElementRemainsDisabled()
        {
            var targetUIElement = new UIElement();

            targetUIElement.IsEnabled = false;

            var target = new TestableCommandBehaviorBase(targetUIElement);

            target.AutoEnable = false;
            TestCommand testCommand = new TestCommand();

            target.Command = testCommand;
            target.ExecuteCommand(null);

            Assert.False(targetUIElement.IsEnabled);
        }
        public void WhenAutoEnableIsUpdated_ThenEnabledUIElementIsDisabled()
        {
            var targetUIElement = new UIElement();

            targetUIElement.IsEnabled = true;

            var target = new TestableCommandBehaviorBase(targetUIElement);

            target.AutoEnable = false;
            TestCommand testCommand = new TestCommand();

            testCommand.CanExecuteResult = false;
            target.Command = testCommand;
            target.ExecuteCommand(null);

            Assert.True(targetUIElement.IsEnabled);

            target.AutoEnable = true;

            Assert.False(targetUIElement.IsEnabled);
        }