Пример #1
0
        public async Task Should_get_nodes()
        {
            var nodes = (await managementClient.GetNodesAsync().ConfigureAwait(false)).ToList();

            nodes.Count.ShouldNotEqual(0);
            nodes[0].Name.ShouldEqual($"rabbit@{rabbitHostName}");
        }
        /// <summary>
        ///     A list of nodes in the RabbitMQ cluster.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public static IReadOnlyList <Node> GetNodes(
            [NotNull] this IManagementClient source,
            CancellationToken cancellationToken = default
            )
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

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