public async Task BasicQueueCrudOperations() { var queueName = nameof(BasicQueueCrudOperations).ToLower() + Guid.NewGuid().ToString("D").Substring(0, 8); var client = new ServiceBusManagementClient(TestEnvironment.ServiceBusConnectionString); var queueOptions = new CreateQueueOptions(queueName) { AutoDeleteOnIdle = TimeSpan.FromHours(1), DefaultMessageTimeToLive = TimeSpan.FromDays(2), DuplicateDetectionHistoryTimeWindow = TimeSpan.FromMinutes(1), EnableBatchedOperations = false, DeadLetteringOnMessageExpiration = true, EnablePartitioning = false, ForwardDeadLetteredMessagesTo = null, ForwardTo = null, LockDuration = TimeSpan.FromSeconds(45), MaxDeliveryCount = 8, MaxSizeInMegabytes = 2048, RequiresDuplicateDetection = true, RequiresSession = false, UserMetadata = nameof(BasicQueueCrudOperations), Status = EntityStatus.Disabled }; queueOptions.AuthorizationRules.Add(new SharedAccessAuthorizationRule( "allClaims", new[] { AccessRights.Manage, AccessRights.Send, AccessRights.Listen })); QueueProperties createdQueue = await client.CreateQueueAsync(queueOptions); Assert.AreEqual(queueOptions, new CreateQueueOptions(createdQueue)); QueueProperties getQueue = await client.GetQueueAsync(queueOptions.Name); Assert.AreEqual(createdQueue, getQueue); getQueue.EnableBatchedOperations = false; getQueue.MaxDeliveryCount = 9; getQueue.AuthorizationRules.Clear(); getQueue.AuthorizationRules.Add(new SharedAccessAuthorizationRule( "noManage", new[] { AccessRights.Send, AccessRights.Listen })); getQueue.EnableBatchedOperations = true; getQueue.Status = EntityStatus.Disabled; getQueue.AutoDeleteOnIdle = TimeSpan.FromMinutes(6); getQueue.MaxSizeInMegabytes = 1024; QueueProperties updatedQueue = await client.UpdateQueueAsync(getQueue); Assert.AreEqual(getQueue, updatedQueue); bool isExists = await client.QueueExistsAsync(queueName); Assert.True(isExists); List <QueueProperties> queueList = new List <QueueProperties>(); await foreach (QueueProperties queue in client.GetQueuesAsync()) { queueList.Add(queue); } queueList = queueList.Where(e => e.Name.StartsWith(nameof(BasicQueueCrudOperations).ToLower())).ToList(); Assert.True(queueList.Count == 1, $"Expected 1 queue but {queueList.Count} queues returned"); Assert.AreEqual(queueList.First().Name, queueName); await client.DeleteQueueAsync(updatedQueue.Name); Assert.That( async() => await client.GetQueueAsync(queueOptions.Name), Throws.InstanceOf <ServiceBusException>().And.Property(nameof(ServiceBusException.Reason)).EqualTo(ServiceBusException.FailureReason.MessagingEntityNotFound)); isExists = await client.QueueExistsAsync(queueName); Assert.False(isExists); }