public async Task Should_be_able_to_get_an_individual_vhost() { await managementClient.CreateVhostAsync(testVHost).ConfigureAwait(false); var vhost = await managementClient.GetVhostAsync(testVHost).ConfigureAwait(false); vhost.Name.ShouldEqual(testVHost); }
public async Task Should_get_queues_by_vhost() { var vhost = await managementClient.CreateVhostAsync(testVHost).ConfigureAwait(false); vhost.Name.ShouldEqual(testVHost); var queueName = $"{testVHost}_{testQueue}"; await CreateTestQueueInVhost(queueName, vhost).ConfigureAwait(false); (await managementClient.GetQueuesAsync(vhost).ConfigureAwait(false)).ToList().Count.ShouldBeGreaterThan(0); }
public async Task Should_be_able_to_delete_permissions() { var userInfo = new UserInfo(testUser, "topSecret").AddTag("monitoring").AddTag("management"); var user = await managementClient.CreateUserAsync(userInfo).ConfigureAwait(false); var vhost = await managementClient.CreateVhostAsync(testVHost).ConfigureAwait(false); var permissionInfo = new PermissionInfo(user, vhost); await managementClient.CreatePermissionAsync(permissionInfo).ConfigureAwait(false); var permission = (await managementClient.GetPermissionsAsync().ConfigureAwait(false)) .SingleOrDefault(x => x.User == testUser && x.Vhost == testVHost); if (permission == null) { throw new EasyNetQTestException(string.Format("No permission for vhost: {0} and user: {1}", testVHost, testUser)); } await managementClient.DeletePermissionAsync(permission).ConfigureAwait(false); }
/// <summary> /// Create a new virtual host /// </summary> /// <param name="source"></param> /// <param name="vhostName">The name of the new virtual host</param> /// <param name="cancellationToken"></param> public static Vhost CreateVhost( [NotNull] this IManagementClient source, string vhostName, CancellationToken cancellationToken = default ) { if (source == null) { throw new ArgumentNullException(nameof(source)); } return(source.CreateVhostAsync(vhostName, cancellationToken) .GetAwaiter() .GetResult()); }