Esempio n. 1
0
        /// <summary>
        /// Fabricate a result by multiplying the input by 2
        /// </summary>
        /// <param name="note">event the <c>INotification</c> carrying the <c>SimpleCommandTestVO</c></param>
        public override void Execute(INotification note)
        {
            SimpleCommandTestVO vo = (SimpleCommandTestVO)note.Body;

            // Fabricate a result
            vo.Result = 2 * vo.Input;
        }
Esempio n. 2
0
        /// <summary>
        /// Tests the <c>execute</c> method of a <c>SimpleCommand</c>.
        /// </summary>
        /// <remarks>
        ///     <para>
        ///         This test creates a new <c>Notification</c>, adding a
        ///         <c>SimpleCommandTestVO</c> as the body.
        ///         It then creates a <c>SimpleCommandTestCommand</c> and invokes
        ///         its <c>execute</c> method, passing in the note.
        ///     </para>
        ///     <para>
        ///         Success is determined by evaluating a property on the
        ///         object that was passed on the Notification body, which will
        ///         be modified by the SimpleCommand
        ///     </para>
        /// </remarks>
        //[TestMethod]
        public void TestExecute()
        {
            // Create the VO
            SimpleCommandTestVO 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");
        }