Exemple #1
0
        public async Task Should_get_all_bindings_for_which_the_exchange_is_the_destination()
        {
            var sourceXchange = await CreateExchange("sourceXcg").ConfigureAwait(false);

            var destionationXchange = await CreateExchange("destinationXcg").ConfigureAwait(false);

            var bindingInfo = new BindingInfo("#");
            await managementClient.CreateBindingAsync(sourceXchange, destionationXchange, bindingInfo).ConfigureAwait(false);

            Assert.NotEmpty((await managementClient.GetBindingsWithDestinationAsync(destionationXchange).ConfigureAwait(false)).ToList());
        }
        /// <summary>
        ///     A list of all bindings in which a given exchange is the destination.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="exchange"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public static IReadOnlyList <Binding> GetBindingsWithDestination(
            [NotNull] this IManagementClient source,
            [NotNull] Exchange exchange,
            CancellationToken cancellationToken = default
            )
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(source.GetBindingsWithDestinationAsync(exchange, cancellationToken)
                   .GetAwaiter()
                   .GetResult());
        }