public async Task VerifyMessageCrossesBridge() { // Create the source message bus. var sourceBus = new MockMessageBus(); var sourceEntity = Any.String(); // Create the target message bus. var targetBus = new MockMessageBus(); const string TargetEntity = "TestEventHub"; // Setup the target callback. This is the output of the bridge. var called = false; await targetBus.RegisterHandlerAsync(TargetEntity, "TestEventHub", m => Task.Run(() => { called = true; })); // Create the message bus bridge. var bridgeName = Any.String(); var bridge = new MySimpleMessageBridge(); await bridge.InitializeAsync( new MessageBusBridgeDescription { BridgeName = bridgeName, SourceBus = sourceBus, SourceEntity = sourceEntity, TargetBus = targetBus, TargetEntity = TargetEntity }); // Send the message. var message = new MockMessage { CorrelationKey = Any.String(), Message = "{\"Name\":\"TestEventHub\"}", MessageKey = Any.String(), PartitionKey = Any.String() }; await sourceBus.SendAsync(sourceEntity, message); // Assert that the message reached the other side. Assert.IsTrue(called, "The target callback must be called."); await bridge.CloseAsync(); }