public void same_message_n_times_it_should_be_handled_n_times() { var handler = new TestHandler<TestMessageWithId>(); var message = new TestMessageWithId(11); _bus.Subscribe<TestMessageWithId>(handler); _bus.Publish(message); _bus.Publish(message); _bus.Publish(message); Assert.That(handler.HandledMessages.ContainsN<TestMessageWithId>(3, mes => mes.Id == 11)); }
public void multiple_messages_of_same_type_they_all_should_be_delivered() { var handler = new TestHandler<TestMessageWithId>(); var message1 = new TestMessageWithId(1); var message2 = new TestMessageWithId(2); var message3 = new TestMessageWithId(3); _bus.Subscribe<TestMessageWithId>(handler); _bus.Publish(message1); _bus.Publish(message2); _bus.Publish(message3); Assert.That(handler.HandledMessages.ContainsSingle<TestMessageWithId>(mes => mes.Id == 1)); Assert.That(handler.HandledMessages.ContainsSingle<TestMessageWithId>(mes => mes.Id == 2)); Assert.That(handler.HandledMessages.ContainsSingle<TestMessageWithId>(mes => mes.Id == 3)); }