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)); }
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)); }
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)); }
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)); }