public void SetQueueServiceProperties_TurnOnLoggingAndMetrics_SuccessfullyTurnsOnOptionsOnService()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var expectedServiceProperties = new StorageServiceProperties();
            expectedServiceProperties.Logging = new StorageServiceLoggingProperties()
            {
                Delete = true,
                Read = true,
                Write = true,
                RetentionPolicyEnabled = true,
                RetentionPolicyNumberOfDays = 123
            };
            expectedServiceProperties.HourMetrics = new StorageServiceMetricsProperties()
            {
                Enabled = true,
                IncludeAPIs = true,
                RetentionPolicyEnabled = true,
                RetentionPolicyNumberOfDays = 45
            };
            expectedServiceProperties.MinuteMetrics = new StorageServiceMetricsProperties()
            {
                Enabled = true,
                IncludeAPIs = true,
                RetentionPolicyEnabled = true,
                RetentionPolicyNumberOfDays = 45
            };
            _util.SetServicePropertiesOff();

            client.SetQueueServiceProperties(expectedServiceProperties);

            var actualProperties = _util.GetServiceProperties();
            Assert.AreEqual(Microsoft.WindowsAzure.Storage.Shared.Protocol.LoggingOperations.All, actualProperties.Logging.LoggingOperations);
            Assert.AreEqual(123, actualProperties.Logging.RetentionDays);
            Assert.AreEqual(Microsoft.WindowsAzure.Storage.Shared.Protocol.MetricsLevel.ServiceAndApi, actualProperties.HourMetrics.MetricsLevel);
            Assert.AreEqual(45, actualProperties.HourMetrics.RetentionDays);
        }
        public void SetQueueServiceProperties_AddCorsRule_SuccessfullyAddsCorsRuleToService()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var expectedServiceProperties = new StorageServiceProperties();
            expectedServiceProperties.Cors.Add(new StorageServiceCorsRule() {
                AllowedHeaders = new List<string>() { "X-Whatever" },
                AllowedMethods = new List<string>() {  "GET" },
                AllowedOrigins = new List<string>() {  "a.b.c" },
                ExposedHeaders = new List<string>() {  "X-Whatever" },
                MaxAgeInSeconds = 7
            });
            _util.ClearCorsRules();

            client.SetQueueServiceProperties(expectedServiceProperties);

            var actualProperties = _util.GetServiceProperties();
            Assert.AreEqual(1, actualProperties.Cors.CorsRules.Count);
            Assert.AreEqual("X-Whatever", actualProperties.Cors.CorsRules[0].AllowedHeaders[0]);
            Assert.AreEqual(Microsoft.WindowsAzure.Storage.Shared.Protocol.CorsHttpMethods.Get, actualProperties.Cors.CorsRules[0].AllowedMethods);
            Assert.AreEqual("a.b.c", actualProperties.Cors.CorsRules[0].AllowedOrigins[0]);
            Assert.AreEqual("X-Whatever", actualProperties.Cors.CorsRules[0].ExposedHeaders[0]);
            Assert.AreEqual(7, actualProperties.Cors.CorsRules[0].MaxAgeInSeconds);
        }
        public void SetQueueServiceProperties_TurnOffLoggingAndMetrics_SuccessfullyTurnsOffOptionsOnService()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var expectedServiceProperties = new StorageServiceProperties();
            expectedServiceProperties.Logging = new StorageServiceLoggingProperties()
            {
                Delete = false,
                Read = false,
                Write = false,
                RetentionPolicyEnabled = false
            };
            expectedServiceProperties.HourMetrics = new StorageServiceMetricsProperties()
            {
                Enabled = false,
                RetentionPolicyEnabled = false
            };
            expectedServiceProperties.MinuteMetrics = new StorageServiceMetricsProperties()
            {
                Enabled = false,
                RetentionPolicyEnabled = false
            };
            _util.SetServicePropertiesOn();

            client.SetQueueServiceProperties(expectedServiceProperties);

            var actualProperties = _util.GetServiceProperties();
            Assert.AreEqual(Microsoft.WindowsAzure.Storage.Shared.Protocol.LoggingOperations.None, actualProperties.Logging.LoggingOperations);
            Assert.AreEqual(Microsoft.WindowsAzure.Storage.Shared.Protocol.MetricsLevel.None, actualProperties.HourMetrics.MetricsLevel);
        }