title: How best to wait for a RabbitMQ event
body: <p>I am writing integration events for my micro-service-based application, where services are decoupled an interact via a message bus such as RabbitMQ. For the integration tests, I use actual components and not mocking any component, hence I am using an actual RabbitMQ service. </p>
  
  <p>One of my services subscribes to an event, when the event is fired, it does some process, and informs about the success of process. So, for testing it, the integration test should publish the event the service listens to, and wait for the services "success" event. (It makes more sense in the actual application, hence for the sake of clarity I've simplified it a bit, hence may sound a bit clumsy design.) </p>
  
  <p>In short, the test is implemented as: </p>
  
  <pre class="lang-cs prettyprint-override"><code>public class ProcessCompletedIntegrationEventHandler: 
      IIntegrationEventHandler&lt;ProcessCompletedIntegrationEvent&gt;
  {
      public Task Handle(ProcessCompletedIntegrationEvent @event)
      {
          // When I put a break point here, I can see this method is called 
          // after the service under the test has completed its task and has 
          // published the message.
      }
  }
  
  public class IntegrationTests
  {
      [Fact]
      public async Task IfReceivesAndPublishesEvents()
      {
          // Arrange
          _rabbitMQBus.Subscribe&lt;
                ProcessCompletedIntegrationEvent,
                ProcessCompletedIntegrationEventHandler&gt;();
  
          // Act
          Eventbus.Publish(new ProcessIntegrationEvent(name: "test"));
  
          // Assert
          // how should I assert if `ProcessCompletedIntegrationEventHandler` is called?
      }
  }
  </code></pre>
  
  <p>Question: what should add to the <code>Handle</code> method of the <code>ProcessCompletedIntegrationEventHandler</code> and how check it in the test. </p>
  
  <p>(For some reasons, I am not interested in assertions based on querying the RabbitMQ and checking if the related message is there.)</p>