コード例 #1
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");
        }