public void SetQueueACL_ValidQueueAndMultipledentifiers_AddsPoliciesToQueue()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            _util.CreateQueue(queueName);
            var expectedStartTime = _util.GetTruncatedUtcNow();
            var expectedIdentifiers = new List<QueueSignedIdentifier>(){
                new QueueSignedIdentifier()
                {
                    Id = "abc-123a",
                    AccessPolicy = new QueueAccessPolicy()
                    {
                        StartTime = expectedStartTime.AddMinutes(12),
                        Expiry = expectedStartTime.AddHours(1),
                        Permission = QueueSharedAccessPermissions.Add
                    }
                },
                new QueueSignedIdentifier()
                {
                    Id = "abc-123b",
                    AccessPolicy = new QueueAccessPolicy()
                    {
                        StartTime = expectedStartTime.AddMinutes(34),
                        Expiry = expectedStartTime.AddHours(1),
                        Permission = QueueSharedAccessPermissions.Add
                    }
                }
            };

            client.SetQueueACL(queueName, expectedIdentifiers);

            var actual = _util.GetQueuePermissions(queueName);
            Assert.AreEqual(2, actual.SharedAccessPolicies.Count);
            foreach (var expectedIdentifier in expectedIdentifiers)
            {
                _util.AssertIdentifierInSharedAccessPolicies(actual.SharedAccessPolicies, expectedIdentifier);
            }
        }
        public void SetQueueACL_NonExistentQueue_ThrowsQueueNotFoundException()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            var expectedStartTime = _util.GetTruncatedUtcNow();
            var expectedIdentifier = new QueueSignedIdentifier()
            {
                Id = "abc-123",
                AccessPolicy = new QueueAccessPolicy()
                {
                    StartTime = expectedStartTime,
                    Expiry = expectedStartTime.AddHours(1),
                    Permission = QueueSharedAccessPermissions.Add
                }
            };

            client.SetQueueACL(queueName, new List<QueueSignedIdentifier>() { expectedIdentifier });

            //expects exception
        }
        public void SetQueueACL_ValidQueue_AddsPolicyToQueue()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            _util.CreateQueue(queueName);
            var expectedStartTime = _util.GetTruncatedUtcNow();
            var expectedIdentifier = new QueueSignedIdentifier()
            {
                Id = "abc-123",
                AccessPolicy = new QueueAccessPolicy()
                {
                    StartTime = expectedStartTime,
                    Expiry = expectedStartTime.AddHours(1),
                    Permission = QueueSharedAccessPermissions.Add
                }
            };

            client.SetQueueACL(queueName, new List<QueueSignedIdentifier>() { expectedIdentifier });

            var actual = _util.GetQueuePermissions(queueName);
            Assert.AreEqual(1, actual.SharedAccessPolicies.Count);
            _util.AssertIdentifierInSharedAccessPolicies(actual.SharedAccessPolicies, expectedIdentifier);
        }