Пример #1
0
        public void WhenCommandParameterNotSet_ThenEventArgsPassed()
        {
            var eventArgs     = new TestEventArgs(null);
            var someControl   = new TextBox();
            var command       = new MockCommand();
            var parameter     = new object();
            var commandAction = new InvokeCommandAction();

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

            commandAction.InvokeAction(eventArgs);

            Assert.IsInstanceOfType(command.ExecuteParameter, typeof(TestEventArgs));
        }
Пример #2
0
        public void WhenCommandParameterNotSetAndEventArgsParameterPathSet_ThenPathedValuePassed()
        {
            var eventArgs     = new TestEventArgs("testname");
            var someControl   = new TextBox();
            var command       = new MockCommand();
            var parameter     = new object();
            var commandAction = new InvokeCommandAction();

            commandAction.Command = command;
            commandAction.TriggerParameterPath = "Thing1.Thing2.Name";
            commandAction.Attach(someControl);

            commandAction.InvokeAction(eventArgs);

            Assert.AreEqual("testname", command.ExecuteParameter);
        }
        public void WhenCommandParameterNotSetAndEventArgsParameterPathSet_ThenPathedValuePassed()
        {
            var eventArgs = new TestEventArgs("testname");
            var someControl = new TextBox();
            var command = new MockCommand();
            var parameter = new object();
            var commandAction = new InvokeCommandAction();
            commandAction.Command = command;
            commandAction.TriggerParameterPath = "Thing1.Thing2.Name";
            commandAction.Attach(someControl);

            commandAction.InvokeAction(eventArgs);

            Assert.AreEqual("testname", command.ExecuteParameter);
        }
        public void WhenCommandParameterNotSet_ThenEventArgsPassed()
        {
            var eventArgs = new TestEventArgs(null);
            var someControl = new TextBox();
            var command = new MockCommand();
            var parameter = new object();
            var commandAction = new InvokeCommandAction();
            commandAction.Command = command;
            commandAction.Attach(someControl);

            commandAction.InvokeAction(eventArgs);

            Assert.IsInstanceOfType(command.ExecuteParameter, typeof(TestEventArgs));
        }