public void ListQueues_AtLeastOneQueue_ReturnsListContainingThatQueue()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            _util.CreateQueue(queueName);

            var response = client.ListQueues();

            Assert.IsTrue(response.Queues.Any(q => q.Name == queueName));
        }
        public void ListQueues_WithPrefix_ReturnsListContainingOnlyQueuesWithThatPrefix()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueNames = new List<string>();
            for (int i = 18; i < 21; i++)
            {
                var queueName = GenerateSampleQueueName(i.ToString());
                _util.CreateQueue(queueName);
                queueNames.Add(queueName);
            }

            var response = client.ListQueues("1");

            Assert.AreEqual("1", response.Prefix);
            Assert.IsTrue(response.Queues.Count(q => q.Name.StartsWith("1")) >= 2);
            Assert.AreEqual(0, response.Queues.Count(q => !q.Name.StartsWith("1")));
        }
        public void ListQueues_WithContinuationMarker_ReturnsRemainderOfList()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueNames = new List<string>();
            for (int i = 0; i < 5; i++)
            {
                var queueName = GenerateSampleQueueName(i.ToString());
                _util.CreateQueue(queueName);
                queueNames.Add(queueName);
            }
            var response = client.ListQueues(maxResults: 3);

            var response2 = client.ListQueues(marker: response.Marker);

            Assert.IsNotEmpty(response2.Queues);
            Assert.GreaterOrEqual(response2.Queues.Count, 2);
        }
        public void ListQueues_MaxResultsSmallerThanQueueList_ReturnsOnlyThatManyResults()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueNames = new List<string>();
            for (int i = 0; i < 5; i++)
            {
                var queueName = GenerateSampleQueueName(i.ToString());
                _util.CreateQueue(queueName);
                queueNames.Add(queueName);
            }

            var response = client.ListQueues(maxResults: 3);

            Assert.AreEqual(3, response.Queues.Count);
        }
        public void ListQueues_IncludingMetadata_ReturnsQueuesWithMetadata()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            _util.CreateQueue(queueName, new Dictionary<string, string>() { 
                {"a", "1"},
                {"b", "2"}
            });

            var response = client.ListQueues(includeMetadata: true);

            Assert.IsTrue(response.Queues.Any(q => q.Name == queueName));
            var queue = response.Queues.Where(q => q.Name == queueName).Single();
            Assert.IsNotEmpty(queue.Metadata);
            Assert.AreEqual("1", queue.Metadata["a"]);
            Assert.AreEqual("2", queue.Metadata["b"]);
        }