public async Task SetQueueServicePropertiesAsync_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(); await client.SetQueueServicePropertiesAsync(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 async Task SetQueueServicePropertiesAsync_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(); await client.SetQueueServicePropertiesAsync(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); }