Esempio n. 1
0
 private async Task <Exchange> EnsureExchangeExists(string exchangeName)
 {
     return((await managementClient
             .GetExchangesAsync().ConfigureAwait(false))
            .SingleOrDefault(x => x.Name == exchangeName)
            ?? await CreateExchange(exchangeName).ConfigureAwait(false));
 }
Esempio n. 2
0
        public async Task Should_get_exchanges()
        {
            var exchanges = await managementClient.GetExchangesAsync().ConfigureAwait(false);

            foreach (Exchange exchange in exchanges)
            {
                Console.Out.WriteLine("exchange.Name = {0}", exchange.Name);
            }
        }
        /// <summary>
        ///     A list of all exchanges.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public static IReadOnlyList <Exchange> GetExchanges(
            [NotNull] this IManagementClient source,
            CancellationToken cancellationToken = default
            )
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

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