本文整理匯總了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);
}