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


C# CloudFilesProvider.GetAccountMetaData方法代码示例

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


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

示例1: Should_Update_Headers_For_Account

        public void Should_Update_Headers_For_Account()
        {
            var headers = new Dictionary<string, string>();
            headers.Add("X-Account-Meta-Test-Accountmetadata", "Test1");

            var provider = new CloudFilesProvider();
            provider.UpdateAccountHeaders(headers, identity: _testIdentity);
            var accountHeadersResponse = provider.GetAccountMetaData(identity: _testIdentity);

            Assert.IsNotNull(accountHeadersResponse);
            Assert.IsTrue(accountHeadersResponse.ContainsKey("Test-Accountmetadata"));
            Assert.AreEqual("Test1", accountHeadersResponse.Where(x => x.Key.Equals("Test-Accountmetadata", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);

        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:14,代码来源:CloudFilesTests.cs

示例2: TestUpdateAccountMetadata

        public void TestUpdateAccountMetadata()
        {
            IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
            Dictionary<string, string> metadata = provider.GetAccountMetaData();
            if (metadata.Any(i => i.Key.StartsWith(TestKeyPrefix, StringComparison.OrdinalIgnoreCase)))
            {
                Assert.Inconclusive("The account contains metadata from a previous unit test run. Run CleanupTestAccountMetadata and try again.");
                return;
            }

            // test add metadata
            TestGetAccountMetaData();
            provider.UpdateAccountMetadata(
                new Dictionary<string, string>
            {
                { TestKeyPrefix + "1", "Value ij" },
                { TestKeyPrefix + "2", "Value ²" },
            });
            TestGetAccountMetaData();

            Dictionary<string, string> expected =
                new Dictionary<string, string>
            {
                { TestKeyPrefix + "1", "Value ij" },
                { TestKeyPrefix + "2", "Value ²" },
            };
            CheckMetadataCollections(expected, GetAccountMetadataWithPrefix(provider, TestKeyPrefix));

            // test update metadata
            provider.UpdateAccountMetadata(
                new Dictionary<string, string>
            {
                { TestKeyPrefix + "1", "Value 1" },
            });

            expected = new Dictionary<string, string>
            {
                { TestKeyPrefix + "1", "Value 1" },
                { TestKeyPrefix + "2", "Value ²" },
            };
            CheckMetadataCollections(expected, GetAccountMetadataWithPrefix(provider, TestKeyPrefix));

            // test remove metadata
            provider.UpdateAccountMetadata(
                new Dictionary<string, string>
            {
                { TestKeyPrefix + "1", null },
                { TestKeyPrefix + "2", string.Empty },
            });

            expected = new Dictionary<string, string>();
            CheckMetadataCollections(expected, GetAccountMetadataWithPrefix(provider, TestKeyPrefix));
        }
开发者ID:nick-o,项目名称:openstack.net,代码行数:53,代码来源:UserObjectStorageTests.cs

示例3: Should_Get_MetaData_For_Account

        public void Should_Get_MetaData_For_Account()
        {

            var provider = new CloudFilesProvider();
            var accountHeadersResponse = provider.GetAccountMetaData(identity: _testIdentity);

            Assert.IsNotNull(accountHeadersResponse);
            Assert.IsTrue(accountHeadersResponse.ContainsKey("Temp-Url-Key"));
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:9,代码来源:CloudFilesTests.cs

示例4: TestAccountHeaderKeyCharacters

        public void TestAccountHeaderKeyCharacters()
        {
            IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);

            List<char> keyCharList = new List<char>();
            for (char i = MinHeaderKeyCharacter; i <= MaxHeaderKeyCharacter; i++)
            {
                if (!SeparatorCharacters.Contains(i) && !NotSupportedCharacters.Contains(i))
                    keyCharList.Add(i);
            }

            string key = TestKeyPrefix + new string(keyCharList.ToArray());
            Console.WriteLine("Expected key: {0}", key);

            provider.UpdateAccountMetadata(
                new Dictionary<string, string>
                {
                    { key, "Value" }
                });

            Dictionary<string, string> metadata = provider.GetAccountMetaData();
            Assert.IsNotNull(metadata);

            string value;
            Assert.IsTrue(metadata.TryGetValue(key, out value));
            Assert.AreEqual("Value", value);

            provider.UpdateAccountMetadata(
                new Dictionary<string, string>
                {
                    { key, null }
                });

            metadata = provider.GetAccountMetaData();
            Assert.IsNotNull(metadata);
            Assert.IsFalse(metadata.TryGetValue(key, out value));
        }
开发者ID:nick-o,项目名称:openstack.net,代码行数:37,代码来源:UserObjectStorageTests.cs

示例5: TestGetAccountMetaData

        public void TestGetAccountMetaData()
        {
            IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
            Dictionary<string, string> metadata = provider.GetAccountMetaData();
            Assert.IsNotNull(metadata);
            Assert.AreEqual(StringComparer.OrdinalIgnoreCase, metadata.Comparer);

            Console.WriteLine("Account MetaData:");
            foreach (var pair in metadata)
            {
                Assert.IsNotNull(pair.Key);
                Assert.IsNotNull(pair.Value);
                Assert.IsFalse(string.IsNullOrEmpty(pair.Key));
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);
            }
        }
开发者ID:nick-o,项目名称:openstack.net,代码行数:16,代码来源:UserObjectStorageTests.cs

示例6: CleanupAllAccountMetadata

 public void CleanupAllAccountMetadata()
 {
     IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
     Dictionary<string, string> metadata = provider.GetAccountMetaData();
     Dictionary<string, string> removedMetadata = metadata.ToDictionary(i => i.Key, i => string.Empty);
     provider.UpdateAccountMetadata(removedMetadata);
 }
开发者ID:nick-o,项目名称:openstack.net,代码行数:7,代码来源:UserObjectStorageTests.cs

示例7: Should_Update_Headers_For_Account

        public void Should_Update_Headers_For_Account()
        {
            var headers = new Dictionary<string, string>();
            headers.Add("Test-Accountmetadata", "Test1");

            var provider = new CloudFilesProvider();
            provider.UpdateAccountMetadata(headers, identity: _testIdentity);
            var accountHeadersResponse = provider.GetAccountMetaData(identity: _testIdentity);

            Assert.IsNotNull(accountHeadersResponse);
            string value;
            Assert.IsTrue(accountHeadersResponse.TryGetValue("Test-Accountmetadata", out value));
            Assert.AreEqual("Test1", value);
        }
开发者ID:charlyraffellini,项目名称:openstack.net,代码行数:14,代码来源:CloudFilesTests.cs

示例8: Should_Add_MetaData_For_Account

        public void Should_Add_MetaData_For_Account()
        {
            var metaData = new Dictionary<string, string>();
            metaData.Add("Test-Accountmetadata", "Test");
            var provider = new CloudFilesProvider();
            provider.UpdateAccountMetadata(metaData, identity: _testIdentity);
            var accountHeadersResponse = provider.GetAccountMetaData(identity: _testIdentity);

            Assert.IsNotNull(accountHeadersResponse);
            Assert.IsTrue(accountHeadersResponse.ContainsKey("Test-Accountmetadata"));
            Assert.AreEqual("Test", accountHeadersResponse.Where(x => x.Key.Equals("Test-Accountmetadata", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value);

        }
开发者ID:charlyraffellini,项目名称:openstack.net,代码行数:13,代码来源:CloudFilesTests.cs


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