當前位置: 首頁>>代碼示例>>C#>>正文


C# CloudFilesProvider.GetContainerHeader方法代碼示例

本文整理匯總了C#中net.openstack.Providers.Rackspace.CloudFilesProvider.GetContainerHeader方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudFilesProvider.GetContainerHeader方法的具體用法?C# CloudFilesProvider.GetContainerHeader怎麽用?C# CloudFilesProvider.GetContainerHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.openstack.Providers.Rackspace.CloudFilesProvider的用法示例。


在下文中一共展示了CloudFilesProvider.GetContainerHeader方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Should_Get_Headers_For_Container

        public void Should_Get_Headers_For_Container()
        {
            var provider = new CloudFilesProvider();
            var objectHeadersResponse = provider.GetContainerHeader(containerName, identity: _testIdentity);

            Assert.IsNotNull(objectHeadersResponse);
            //Assert.AreEqual("Christian Bale", objectHeadersResponse.Where(x => x.Key.Equals("X-Object-Meta-Actor", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
        }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:8,代碼來源:CloudFilesTests.cs

示例2: TestVersionedContainer

        public void TestVersionedContainer()
        {
            IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
            string containerName = TestContainerPrefix + Path.GetRandomFileName();
            string versionsContainerName = TestContainerPrefix + Path.GetRandomFileName();

            ObjectStore result = provider.CreateContainer(versionsContainerName);
            Assert.AreEqual(ObjectStore.ContainerCreated, result);

            result = provider.CreateContainer(containerName, new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { CloudFilesProvider.VersionsLocation, versionsContainerName } });
            Assert.AreEqual(ObjectStore.ContainerCreated, result);

            Dictionary<string, string> headers = provider.GetContainerHeader(containerName);
            string location;
            Assert.IsTrue(headers.TryGetValue(CloudFilesProvider.VersionsLocation, out location));
            Assert.AreEqual(versionsContainerName, location);

            string objectName = Path.GetRandomFileName();
            string fileData1 = "first-content";
            string fileData2 = "second-content";

            /*
             * Create the object
             */

            using (MemoryStream uploadStream = new MemoryStream(Encoding.UTF8.GetBytes(fileData1)))
            {
                provider.CreateObject(containerName, uploadStream, objectName);
            }

            string actualData = ReadAllObjectText(provider, containerName, objectName, Encoding.UTF8);
            Assert.AreEqual(fileData1, actualData);

            /*
             * Overwrite the object
             */

            using (MemoryStream uploadStream = new MemoryStream(Encoding.UTF8.GetBytes(fileData2)))
            {
                provider.CreateObject(containerName, uploadStream, objectName);
            }

            actualData = ReadAllObjectText(provider, containerName, objectName, Encoding.UTF8);
            Assert.AreEqual(fileData2, actualData);

            /*
             * Delete the object once
             */

            provider.DeleteObject(containerName, objectName);

            actualData = ReadAllObjectText(provider, containerName, objectName, Encoding.UTF8);
            Assert.AreEqual(fileData1, actualData);

            /*
             * Cleanup
             */

            provider.DeleteContainer(versionsContainerName, deleteObjects: true);
            provider.DeleteContainer(containerName, deleteObjects: true);
        }
開發者ID:nick-o,項目名稱:openstack.net,代碼行數:61,代碼來源:UserObjectStorageTests.cs

示例3: TestGetContainerHeader

        public void TestGetContainerHeader()
        {
            IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
            string containerName = TestContainerPrefix + Path.GetRandomFileName();

            ObjectStore result = provider.CreateContainer(containerName);
            Assert.AreEqual(ObjectStore.ContainerCreated, result);

            Dictionary<string, string> headers = provider.GetContainerHeader(containerName);
            Console.WriteLine("Container Headers");
            foreach (KeyValuePair<string, string> pair in headers)
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);

            provider.DeleteContainer(containerName, deleteObjects: true);
        }
開發者ID:nick-o,項目名稱:openstack.net,代碼行數:15,代碼來源:UserObjectStorageTests.cs

示例4: Should_Get_Headers_For_Container

        public void Should_Get_Headers_For_Container()
        {
            var provider = new CloudFilesProvider();
            var objectHeadersResponse = provider.GetContainerHeader(containerName, identity: _testIdentity);

            Assert.IsNotNull(objectHeadersResponse);
            Assert.IsTrue(objectHeadersResponse.Any());
        }
開發者ID:brendanseabrook,項目名稱:openstack.net,代碼行數:8,代碼來源:CloudFilesTests.cs


注:本文中的net.openstack.Providers.Rackspace.CloudFilesProvider.GetContainerHeader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。