示例#1
0
        public void subscribed_handler_parent_handle_does_not_messages()
        {
            // GIVEN
            var handler = new ChildHandler();

            Bus.Subscribe(handler);
            // WHEN
            Bus.Publish(new ParentMessage());
            // EXPECT
            CollectionAssert.IsEmpty(handler.HandledMessages);
        }
示例#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);
        }