Exemplo n.º 1
0
        public void subscribed_handler_handle_child_messages()
        {
            // GIVEN
            var handler = new ParentHandler();

            Bus.Subscribe(handler);
            // WHEN
            var child = new ChildMessage();

            Bus.Publish(child);
            // EXPECT
            CollectionAssert.AreEqual(new[] { child }, handler.HandledMessages);
        }
Exemplo n.º 2
0
        public void subscribed_parent_and_child_handler_handle_child_messages()
        {
            // GIVEN
            var parentHandler = new ParentHandler();
            var childHandler  = new ChildHandler();

            Bus.Subscribe(parentHandler);
            Bus.Subscribe(childHandler);
            // WHEN
            var childMessage = new ChildMessage();

            Bus.Publish(childMessage);
            // EXPECT
            CollectionAssert.AreEqual(new[] { childMessage }, parentHandler.HandledMessages);
            CollectionAssert.AreEqual(childHandler.HandledMessages, parentHandler.HandledMessages);
        }