public async Task Setup()
        {
            string destinationQueue = GetType().Name;
            await MessageEntityHelper.CreateQueue(destinationQueue);

            var queueConnectionString = Environment.GetEnvironmentVariable("NServiceBus.AzureServiceBusForwarder.ConnectionString", EnvironmentVariableTarget.Process);

            queueClient = QueueClient.CreateFromConnectionString(queueConnectionString, destinationQueue);
        }
Ejemplo n.º 2
0
        public async Task Setup()
        {
            namespaceConnectionString = Environment.GetEnvironmentVariable("NServiceBus.AzureServiceBusForwarder.ConnectionString", EnvironmentVariableTarget.Process);
            destinationQueue = GetType().Name;
            messageForwarder = A.Fake<IMessageForwarder>();
            messageReceiver = new QueueBatchMessageReceiver(QueueClient.CreateFromConnectionString(namespaceConnectionString, destinationQueue));

            await MessageEntityHelper.CreateQueue(destinationQueue);
            
            namespaceManager = NamespaceManager.CreateFromConnectionString(namespaceConnectionString);

            if (await namespaceManager.TopicExistsAsync(TopicName))
            {
                await namespaceManager.DeleteTopicAsync(TopicName);
            }

            await namespaceManager.CreateTopicAsync(TopicName);

            forwarder = new Forwarder(
                new ForwarderConfiguration(
                    new ForwarderSourceConfiguration(500, () => messageReceiver),
                    new ForwarderDestinationConfiguration(destinationQueue, () => messageForwarder)));
        }