当前位置: 首页>>代码示例>>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;未经允许,请勿转载。