public void One_handler_can_handle_multiple_events() { var handler = new FooBarBazHandler(); Bus.Register(handler); var fooEvent = new FooEvent(); var barEvent = new BarEvent(); var bazEvent = new BazEvent(); Bus.Raise(fooEvent); Bus.Raise(barEvent); Bus.Raise(bazEvent); handler.EventsCaught.ElementsShouldEqual(fooEvent, barEvent, bazEvent); }
protected override void RunTest() { ObserveEventsOnThis(); var fooEvent = new FooEvent(); var barEvent = new BarEvent(); var bazEvent = new BazEvent(); var buzzEvent = new BuzzEvent(); Router.PublishEvent(fooEvent); AssertLastReceivedEvent(1, ObservationStage.Preview, fooEvent); Router.PublishEvent(barEvent); AssertLastReceivedEvent(2, ObservationStage.Normal, barEvent); Router.PublishEvent(bazEvent); AssertLastReceivedEvent(3, ObservationStage.Normal, bazEvent); Router.PublishEvent(buzzEvent); AssertLastReceivedEvent(4, ObservationStage.Committed, buzzEvent); }
public async Task Handle(BazEvent busEvent) { RecordMessageReceipt(); }
public void Handle(BazEvent eventToHandle) { EventsCaught.Add(eventToHandle); }