Example #1
0
        public async Task CreateDeleteStorageQueue()
        {
            //create storage queue
            string       storageQueueName = Recording.GenerateAssetName("testqueue");
            StorageQueue queue1           = (await _storageQueueContainer.CreateOrUpdateAsync(storageQueueName, new StorageQueueData())).Value;

            Assert.IsNotNull(queue1);
            Assert.AreEqual(queue1.Id.Name, storageQueueName);

            //validate if successfully created
            StorageQueue queue2 = await _storageQueueContainer.GetAsync(storageQueueName);

            AssertStorageQueueEqual(queue1, queue2);
            Assert.IsTrue(await _storageQueueContainer.CheckIfExistsAsync(storageQueueName));
            Assert.IsFalse(await _storageQueueContainer.CheckIfExistsAsync(storageQueueName + "1"));
            StorageQueueData queueData = queue2.Data;

            Assert.IsEmpty(queueData.Metadata);

            //delete storage queue
            await queue1.DeleteAsync();

            //validate if successfully deleted
            Assert.IsFalse(await _storageQueueContainer.CheckIfExistsAsync(storageQueueName));
            StorageQueue queue3 = await _storageQueueContainer.GetIfExistsAsync(storageQueueName);

            Assert.IsNull(queue3);
        }