本文整理汇总了C#中Syncano.Net.Api.DataObjectSyncanoClient.Move方法的典型用法代码示例。如果您正苦于以下问题:C# DataObjectSyncanoClient.Move方法的具体用法?C# DataObjectSyncanoClient.Move怎么用?C# DataObjectSyncanoClient.Move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Syncano.Net.Api.DataObjectSyncanoClient
的用法示例。
在下文中一共展示了DataObjectSyncanoClient.Move方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Move_WithToMuchFolders_ThrowsException
public async Task Move_WithToMuchFolders_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectSimpleQueryRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Folders = new List<string>();
for (int i = 0; i < DataObjectSyncanoClient.MaxVauluesPerRequest; ++i)
request.Folders.Add("abc");
request.Folder = "abc";
try
{
//when
await client.Move(request);
throw new Exception("Move should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentException>();
}
}
示例2: Move_WithNullCollectionIdAndCollectionKey_ThrowsException
public async Task Move_WithNullCollectionIdAndCollectionKey_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectSimpleQueryRequest();
request.ProjectId = TestData.ProjectId;
try
{
//when
await client.Move(request);
throw new Exception("Move should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentNullException>();
}
}
示例3: Move_WithToBigLimit_ThrowsException
public async Task Move_WithToBigLimit_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectSimpleQueryRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Limit = DataObjectSyncanoClient.MaxVauluesPerRequest + 1;
try
{
//when
await client.Move(request);
throw new Exception("Move should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentException>();
}
}
示例4: Move_ByCollectionKey_WithFolderAndState
public async Task Move_ByCollectionKey_WithFolderAndState(DataObjectSyncanoClient client)
{
//given
var folderClient =
new FolderSyncanoClient(new SyncanoHttpClient(TestData.InstanceName, TestData.BackendAdminApiKey));
var folderOne = await folderClient.New(TestData.ProjectId, "folderOne", TestData.CollectionId);
var folderTwo = await folderClient.New(TestData.ProjectId, "folderTwo", TestData.CollectionId);
var newRequest = new DataObjectDefinitionRequest();
newRequest.ProjectId = TestData.ProjectId;
newRequest.CollectionKey = TestData.CollectionKey;
newRequest.Folder = folderOne.Name;
newRequest.State = DataObjectState.Pending;
var dataObject = await client.New(newRequest);
var moveRequest = new DataObjectSimpleQueryRequest();
moveRequest.ProjectId = TestData.ProjectId;
moveRequest.CollectionKey = TestData.CollectionKey;
moveRequest.DataId = dataObject.Id;
//when
var result = await client.Move(moveRequest, folderTwo.Name, DataObjectState.Moderated);
var resultObject =
await client.GetOne(TestData.ProjectId, TestData.CollectionId, dataId: dataObject.Id);
//then
result.ShouldBeTrue();
resultObject.Folder.ShouldEqual(folderTwo.Name);
//cleanup
await client.Delete(moveRequest);
await folderClient.Delete(TestData.ProjectId, folderOne.Name, TestData.CollectionId);
await folderClient.Delete(TestData.ProjectId, folderTwo.Name, TestData.CollectionId);
}