public void Add(FakeTransportInfrastructure infrastructure)
        {
            infrastructures.Add(infrastructure);

            infrastructure.Dispatcher.MessageSent      += DispatcherOnMessageSent;
            infrastructure.Dispatcher.MessagePublished += DispatcherOnMessagePublished;
        }
    public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings)
    {
        if (router == null)
        {
            router = new FakeTransportRouter();
        }

        var infrastructure = new FakeTransportInfrastructure();

        router.Add(infrastructure);
        configuration.UseTransport <FakeTransport>().Use(infrastructure);

        return(Task.CompletedTask);
    }
    public TransportConfigurationResult Configure(SettingsHolder settings, TransportTransactionMode transactionMode)
    {
        var fakeTransportInfrastructure = new FakeTransportInfrastructure();

        // route local sends to the input queue:
        fakeTransportInfrastructure.Dispatcher.MessageSent += (operation, destination) =>
        {
            if (destination == fakeTransportInfrastructure.MainPump.inputQueue)
            {
                Task.Run(() => fakeTransportInfrastructure.MainPump.Push(
                             operation.Message.Body,
                             operation.Message.MessageId,
                             operation.Message.Headers));
            }
        };

        var transportConfigurationResult = new TransportConfigurationResult
        {
            TransportInfrastructure = fakeTransportInfrastructure
        };

        return(transportConfigurationResult);
    }