public Task SubscribeOneConsumer_SendMessage_ConsumerReceivesMessage() { return(TestHelper.TryTest(async() => { // arrange var cts = new CancellationTokenSource(30000); var eventDescription = new EventDescription( Guid.NewGuid().ToString()); // act IEventStream consumer = await _registry.SubscribeAsync(eventDescription); var outgoing = new EventMessage(eventDescription, "bar"); await _sender.SendAsync(outgoing); // assert IEventMessage incoming = null; await foreach (IEventMessage item in consumer.WithCancellation(cts.Token)) { incoming = item; break; } Assert.Equal(outgoing.Payload, incoming.Payload); })); }