public void TestMessageHub( )
        {
            Component hub = new Component( );
            TestComponent handler = new TestComponent( );

            MessageHub.AddDispatchRecipient( hub, typeof( Message0 ), handler, 0 );
            MessageHub.AddDispatchRecipient( hub, typeof( Message1 ), handler, 0 );
            //  No dispatch method takes parameter of type Message2
            MessageHub.AddDispatchRecipient( hub, typeof( Message3 ), handler, 0 );

            TestHubMessage( hub, new Message0( ), MethodId.TestComponent_Handle_Message0 );
            TestHubMessage( hub, new Message1( ), MethodId.TestComponent_Handle_Message1 );
            TestHubMessage( hub, new Message2( ), MethodId.TestComponent_Handle_Message1 );
            TestHubMessage( hub, new Message3( ), MethodId.TestComponent_Handle_Message3 );
        }
        public void TestComponentOwner( )
        {
            IComponent component = new Component( );
            IComposite composite0 = CreateComposite( );
            IComposite composite1 = CreateComposite( );

            //	Add the component to a composite
            component.Owner = composite0;
            Assert.AreEqual( composite0, component.Owner );
            Assert.IsTrue( composite0.Components.Contains( component ) );

            //	Change the owner of the component
            component.Owner = composite1;
            Assert.AreEqual( composite1, component.Owner );
            Assert.IsTrue( composite1.Components.Contains( component ) );
            Assert.IsFalse( composite0.Components.Contains( component ) );

            //	Remove the component from its current owner
            component.Owner = null;
            Assert.IsNull( component.Owner );
            Assert.IsFalse( composite0.Components.Contains( component ) );
            Assert.IsFalse( composite1.Components.Contains( component ) );
        }