Ejemplo n.º 1
0
        public async Task Should_be_able_to_create_parameter()
        {
            await managementClient.CreateParameterAsync(new Parameter
            {
                Component = "federation-upstream",
                Name      = "myfakefederationupstream1",
                Vhost     = vhostName,
                Value     = new{ value = new { uri = $"amqp://{username}:{password}@{rabbitHostName}" } }
            }).ConfigureAwait(false);

            Assert.Contains(await managementClient.GetParametersAsync().ConfigureAwait(false), p => p.Name == "myfakefederationupstream1");
        }
        /// <summary>
        ///     Creates a parameter on the cluster
        /// </summary>
        /// <param name="source"></param>
        /// <param name="parameter">Parameter to create</param>
        /// <param name="cancellationToken"></param>
        public static void CreateParameter(
            [NotNull] this IManagementClient source,
            [NotNull] Parameter parameter,
            CancellationToken cancellationToken = default
            )
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            source.CreateParameterAsync(parameter, cancellationToken)
            .GetAwaiter()
            .GetResult();
        }