Esempio n. 1
0
        public void WhenAttachedAfterCommandPropertyIsSetAndInvoked_ThenInvokesCommand()
        {
            var someControl = new TextBox();
            var commandAction = new InvokeCommandAction();
            var command = new MockCommand();
            commandAction.Command = command;
            commandAction.Attach(someControl);

            Assert.IsFalse(command.ExecuteCalled);

            commandAction.Invoke();

            Assert.IsTrue(command.ExecuteCalled);
            Assert.AreSame(command, commandAction.GetValue(InvokeCommandAction.CommandProperty));
        }
Esempio n. 2
0
        public void WhenCommandPropertyIsSet_ThenHooksUpCommandBehavior()
        {
            var someControl = new TextBox();
            var commandAction = new InvokeCommandAction();
            var command = new MockCommand();
            commandAction.Attach(someControl);
            commandAction.Command = command;

            Assert.IsFalse(command.ExecuteCalled);

            commandAction.Invoke();

            Assert.IsTrue(command.ExecuteCalled);
            Assert.AreSame(command, commandAction.GetValue(InvokeCommandAction.CommandProperty));
        }
Esempio n. 3
0
        public void WhenAttachedAfterCommandPropertyIsSetAndInvoked_ThenInvokesCommand()
        {
            var someControl   = new TextBox();
            var commandAction = new InvokeCommandAction();
            var command       = new MockCommand();

            commandAction.Command = command;
            commandAction.Attach(someControl);

            Assert.False(command.ExecuteCalled);

            commandAction.InvokeAction(null);

            Assert.True(command.ExecuteCalled);
            Assert.Same(command, commandAction.GetValue(InvokeCommandAction.CommandProperty));
        }
Esempio n. 4
0
        public void WhenCommandPropertyIsSet_ThenHooksUpCommandBehavior()
        {
            var someControl   = new TextBox();
            var commandAction = new InvokeCommandAction();
            var command       = new MockCommand();

            commandAction.Attach(someControl);
            commandAction.Command = command;

            Assert.False(command.ExecuteCalled);

            commandAction.InvokeAction(null);

            Assert.True(command.ExecuteCalled);
            Assert.Same(command, commandAction.GetValue(InvokeCommandAction.CommandProperty));
        }