/**
         * Fabricate a result by multiplying the input by 2
         *
         * @param event the <code>INotification</code> carrying the <code>SimpleCommandTestVO</code>
         */
        public override void Execute(INotification note)
        {
            SimpleCommandTestVO vo = (SimpleCommandTestVO)note.Body;

            // Fabricate a result
            vo.result = 2 * vo.input;
        }
コード例 #2
0
        /**
         * Tests the <code>execute</code> method of a <code>SimpleCommand</code>.
         *
         * <P>
         * This test creates a new <code>Notification</code>, adding a
         * <code>SimpleCommandTestVO</code> as the body.
         * It then creates a <code>SimpleCommandTestCommand</code> and invokes
         * its <code>execute</code> method, passing in the note.</P>
         *
         * <P>
         * Success is determined by evaluating a property on the
         * object that was passed on the Notification body, which will
         * be modified by the SimpleCommand</P>.
         *
         */
        public void TestSimpleCommandExecute()
        {
            // Create the VO
            SimpleCommandTestVO vo = new SimpleCommandTestVO(5);

            // Create the Notification (note)
            INotification note = new Notification("SimpleCommandTestNote", vo);

            // Create the SimpleCommand
            ICommand command = new SimpleCommandTestCommand();

            // Execute the SimpleCommand
            command.Execute(note);

            // test assertions
            Assert.True(vo.result == 10, "Expecting vo.result == 10");
        }
        public void SimpleCommandExecute()
        {
            // Create the VO
              			var vo = new SimpleCommandTestVO(5);

            // Create the Notification (notification)
              			INotification note = new Notification("SimpleCommandTestNote", vo);

            // Create the SimpleCommand
            ICommand command = new SimpleCommandTestCommand();

               			// Execute the SimpleCommand
               			command.Execute(note);

               			// test assertions
            Assert.IsTrue(vo.result == 10, "Expecting vo.result == 10");
        }