public async Task Should_append_namespace_alias_to_reply_address_when_using_aliases() { var runSettings = new RunSettings(); runSettings.TestExecutionTimeout = TimeSpan.FromMinutes(1); var ctx = new AzureServiceBusTransportConfigContext(); ctx.Callback = (endpointName, extensions) => { var connectionString = EnvironmentHelper.GetEnvironmentVariable("AzureServiceBusTransport.ConnectionString"); extensions.ConnectionString(connectionString); extensions.UseNamespaceAliasesInsteadOfConnectionStrings(); }; runSettings.Set("AzureServiceBus.AcceptanceTests.TransportConfigContext", ctx); var context = await Scenario.Define <Context>() .WithEndpoint <SourceEndpoint>(b => { b.When(async(bus, c) => { var sendOptions = new SendOptions(); sendOptions.SetDestination("usingsinglenamespace.targetendpoint"); await bus.Send(new MyRequest(), sendOptions); }); }) .WithEndpoint <TargetEndpoint>() .Done(c => c.ReplyReceived) .Run(runSettings); Assert.IsTrue(context.RequestReceived, "context.RequestReceived"); Assert.IsTrue(context.ReplyReceived, "context.ReplyReceived"); Assert.IsTrue(context.ReplyToContainsNamespaceName, "context.ReplyToContainsNamespaceName"); }
public async Task Should_support_request_reply_across_namespaces_using_aliases() { var runSettings = new RunSettings(); runSettings.TestExecutionTimeout = TimeSpan.FromMinutes(1); var ctx = new AzureServiceBusTransportConfigContext(); ctx.Callback = (endpointName, extensions) => { var connectionString = EnvironmentHelper.GetEnvironmentVariable("AzureServiceBusTransport.ConnectionString"); var targetConnectionString = EnvironmentHelper.GetEnvironmentVariable("AzureServiceBus.ConnectionString.Fallback"); extensions.UseNamespaceAliasesInsteadOfConnectionStrings(); if (endpointName == "UsingMultipleNamespaces.EndpointInTargetNamespace") { extensions.NamespaceRouting().AddNamespace("source", connectionString); extensions.NamespacePartitioning().AddNamespace("target", targetConnectionString); } else { extensions.NamespacePartitioning().AddNamespace("source", connectionString); extensions.NamespaceRouting().AddNamespace("target", targetConnectionString); } }; runSettings.Set("AzureServiceBus.AcceptanceTests.TransportConfigContext", ctx); var context = await Scenario.Define <Context>() .WithEndpoint <EndpointInSourceNamespace>(b => { b.When(async(bus, c) => { var sendOptions = new SendOptions(); sendOptions.SetDestination("usingmultiplenamespaces.endpointintargetnamespace@target"); await bus.Send(new MyRequest(), sendOptions); }); }) .WithEndpoint <EndpointInTargetNamespace>() .Done(c => c.ReplyReceived) .Run(runSettings); Assert.IsTrue(context.RequestReceived, "context.RequestReceived"); Assert.IsTrue(context.ReplyReceived, "context.ReplyReceived"); }