Ejemplo n.º 1
0
        public async Task ShouldSubscribeToAndPublishAnEvent()
        {
            var bus        = new ComponentBus();
            var publisher  = new PublishingComponent(bus);
            var subscriber = new SubscribingComponent(bus);

            await publisher.PublishEvent();

            Assert.Equal(1, subscriber.Count);
        }
Ejemplo n.º 2
0
 public SubscribingComponent(ComponentBus bus)
 {
     bus.Subscribe <TestEventMessage>(ReceiveMessage);
 }
 public GenericSubscribingComponent(ComponentBus bus)
 {
     bus.Subscribe <TestEventMessage>((sender, e) => ReceiveMessage(e));
 }
Ejemplo n.º 4
0
 public PublishingComponent(ComponentBus bus)
 {
     _bus = bus;
 }
 public SubscribingComponent(ComponentBus bus)
 {
     bus.Subscribe(typeof(TestEventMessage), (sender, e) => ReceiveMessage(e));
 }