当前位置: 首页>>代码示例>>C#>>正文


C# QueueServiceClient.SetQueueServicePropertiesAsync方法代码示例

本文整理汇总了C#中QueueServiceClient.SetQueueServicePropertiesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# QueueServiceClient.SetQueueServicePropertiesAsync方法的具体用法?C# QueueServiceClient.SetQueueServicePropertiesAsync怎么用?C# QueueServiceClient.SetQueueServicePropertiesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueueServiceClient的用法示例。


在下文中一共展示了QueueServiceClient.SetQueueServicePropertiesAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetQueueServicePropertiesAsync_AddCorsRule_SuccessfullyAddsCorsRuleToService

        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);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:24,代码来源:AccountOperationsTests.cs

示例2: SetQueueServicePropertiesAsync_TurnOnLoggingAndMetrics_SuccessfullyTurnsOnOptionsOnService

        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);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:36,代码来源:AccountOperationsTests.cs


注:本文中的QueueServiceClient.SetQueueServicePropertiesAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。