本文整理汇总了C#中QueueServiceClient.SetQueueServiceProperties方法的典型用法代码示例。如果您正苦于以下问题:C# QueueServiceClient.SetQueueServiceProperties方法的具体用法?C# QueueServiceClient.SetQueueServiceProperties怎么用?C# QueueServiceClient.SetQueueServiceProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueueServiceClient
的用法示例。
在下文中一共展示了QueueServiceClient.SetQueueServiceProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetQueueServiceProperties_TurnOnLoggingAndMetrics_SuccessfullyTurnsOnOptionsOnService
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);
}
示例2: SetQueueServiceProperties_AddCorsRule_SuccessfullyAddsCorsRuleToService
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);
}
示例3: SetQueueServiceProperties_TurnOffLoggingAndMetrics_SuccessfullyTurnsOffOptionsOnService
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);
}