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