本文整理匯總了C#中Syncano.Net.Api.DataObjectSyncanoClient.Copy方法的典型用法代碼示例。如果您正苦於以下問題:C# DataObjectSyncanoClient.Copy方法的具體用法?C# DataObjectSyncanoClient.Copy怎麽用?C# DataObjectSyncanoClient.Copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Syncano.Net.Api.DataObjectSyncanoClient
的用法示例。
在下文中一共展示了DataObjectSyncanoClient.Copy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Copy_DataIdsListAndDataIdUsed_CreatesNewDataObject
public async Task Copy_DataIdsListAndDataIdUsed_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
var dataObject = await client.New(request);
var dataIds = new List<string>();
dataIds.Add(dataObject.Id);
dataObject = await client.New(request);
var copyRequest = new CopyDataObjectRequest();
copyRequest.ProjectId = TestData.ProjectId;
copyRequest.CollectionId = TestData.CollectionId;
copyRequest.DataIds = dataIds;
copyRequest.DataId = dataObject.Id;
//when
var result = await client.Copy(copyRequest);
//then
result.ShouldNotBeNull();
result.Count.ShouldEqual(2);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例2: Copy_WithNullProjectId_ThrowsException
public async Task Copy_WithNullProjectId_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
var dataObject = await client.New(request);
var copyRequest = new CopyDataObjectRequest();
copyRequest.ProjectId = null;
copyRequest.CollectionId = TestData.CollectionId;
copyRequest.DataId = dataObject.Id;
try
{
//when
await client.Copy(copyRequest);
throw new Exception("New should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentNullException>();
}
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例3: Copy_ByCollectionId_CreatesNewDataObject
public async Task Copy_ByCollectionId_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
var dataObject = await client.New(request);
var copyRequest = new CopyDataObjectRequest();
copyRequest.ProjectId = TestData.ProjectId;
copyRequest.CollectionId = TestData.CollectionId;
copyRequest.DataId = dataObject.Id;
//when
var result = await client.Copy(copyRequest);
//then
result.ShouldNotBeNull();
result[0].Folder.ShouldEqual(request.Folder);
result[0].Id.ShouldNotEqual(dataObject.Id);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}