本文整理汇总了C#中net.openstack.Providers.Rackspace.CloudFilesProvider.MoveObject方法的典型用法代码示例。如果您正苦于以下问题:C# CloudFilesProvider.MoveObject方法的具体用法?C# CloudFilesProvider.MoveObject怎么用?C# CloudFilesProvider.MoveObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.openstack.Providers.Rackspace.CloudFilesProvider
的用法示例。
在下文中一共展示了CloudFilesProvider.MoveObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMoveObject
public void TestMoveObject()
{
IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
string containerName = TestContainerPrefix + Path.GetRandomFileName();
string objectName = Path.GetRandomFileName();
string movedName = Path.GetRandomFileName();
// another random name counts as random content
string fileData = Path.GetRandomFileName();
ObjectStore containerResult = provider.CreateContainer(containerName);
Assert.AreEqual(ObjectStore.ContainerCreated, containerResult);
using (MemoryStream uploadStream = new MemoryStream(Encoding.UTF8.GetBytes(fileData)))
{
provider.CreateObject(containerName, uploadStream, objectName);
}
string actualData = ReadAllObjectText(provider, containerName, objectName, Encoding.UTF8);
Assert.AreEqual(fileData, actualData);
provider.MoveObject(containerName, objectName, containerName, movedName);
try
{
using (MemoryStream downloadStream = new MemoryStream())
{
provider.GetObject(containerName, objectName, downloadStream);
}
Assert.Fail("Expected an exception (object should not exist)");
}
catch (ResponseException)
{
}
actualData = ReadAllObjectText(provider, containerName, movedName, Encoding.UTF8);
Assert.AreEqual(fileData, actualData);
/* Cleanup
*/
provider.DeleteContainer(containerName, deleteObjects: true);
}