public async Task Should_delete_binding() { var sourceXchange = await CreateExchange("sourceXcg").ConfigureAwait(false); var queue = await CreateTestQueue(testQueue).ConfigureAwait(false); var bindingInfo = new BindingInfo("#"); await managementClient.CreateBindingAsync(sourceXchange, queue, bindingInfo).ConfigureAwait(false); var binding = (await managementClient.GetBindingsAsync(sourceXchange, queue).ConfigureAwait(false)).First(); await managementClient.DeleteBindingAsync(binding).ConfigureAwait(false); await managementClient.DeleteExchangeAsync(sourceXchange).ConfigureAwait(false); await managementClient.DeleteQueueAsync(queue).ConfigureAwait(false); }
/// <summary> /// Delete the given binding /// </summary> /// <param name="source"></param> /// <param name="binding"></param> /// <param name="cancellationToken"></param> public static void DeleteBinding( [NotNull] this IManagementClient source, [NotNull] Binding binding, CancellationToken cancellationToken = default ) { if (source == null) { throw new ArgumentNullException(nameof(source)); } source.DeleteBindingAsync(binding, cancellationToken) .GetAwaiter() .GetResult(); }