Пример #1
0
 public async Task Should_get_bindings()
 {
     foreach (var binding in await managementClient.GetBindingsAsync().ConfigureAwait(false))
     {
         Console.Out.WriteLine("binding.Destination = {0}", binding.Destination);
         Console.Out.WriteLine("binding.Source = {0}", binding.Source);
         Console.Out.WriteLine("binding.PropertiesKey = {0}", binding.PropertiesKey);
     }
 }
Пример #2
0
        public async Task Should_be_able_to_get_a_list_of_bindings_between_an_exchange_and_a_queue()
        {
            var queue = await EnsureQueueExists(testQueue).ConfigureAwait(false);

            var exchange = await EnsureExchangeExists(testExchange).ConfigureAwait(false);

            var bindings = (await managementClient.GetBindingsAsync(exchange, queue).ConfigureAwait(false)).ToArray();

            bindings.Length.Should().Be(0);
        }
        /// <summary>
        ///     A list of all bindings.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public static IReadOnlyList <Binding> GetBindings(
            [NotNull] this IManagementClient source,
            CancellationToken cancellationToken = default
            )
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(source.GetBindingsAsync(cancellationToken)
                   .GetAwaiter()
                   .GetResult());
        }