本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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());
}