本文整理汇总了C#中Syncano.Net.Api.DataObjectSyncanoClient.Update方法的典型用法代码示例。如果您正苦于以下问题:C# DataObjectSyncanoClient.Update方法的具体用法?C# DataObjectSyncanoClient.Update怎么用?C# DataObjectSyncanoClient.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Syncano.Net.Api.DataObjectSyncanoClient
的用法示例。
在下文中一共展示了DataObjectSyncanoClient.Update方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update_ByCollectionId_WithUserName_CreatesNewDataObject
public async Task Update_ByCollectionId_WithUserName_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
var dataObject = await client.New(request);
request.UserName = TestData.UserName;
//when
var result = await client.Update(request, dataObject.Id);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(request.Folder);
result.User.Name.ShouldEqual(request.UserName);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
deleteRequest.DataId = result.Id;
await client.Delete(deleteRequest);
}
示例2: Update_WithTooLongAdditionalValue_ThrowsException
public async Task Update_WithTooLongAdditionalValue_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Additional = new Dictionary<string, string>();
request.Additional.Add("additional key", new String('a', DataObjectSyncanoClient.MaxAdditionalValueLenght + 1));
try
{
//when
await client.Update(request);
throw new Exception("Update should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentException>();
}
}
示例3: Update_WithTooLongText_ThrowsException
public async Task Update_WithTooLongText_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Text = new String('a', DataObjectSyncanoClient.MaxTextLenght + 1);
try
{
//when
await client.Update(request);
throw new Exception("Update should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentException>();
}
}
示例4: Update_WithTooMuchAdditionals_ThrowsException
public async Task Update_WithTooMuchAdditionals_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Additional = new Dictionary<string, string>();
for (int i = 0; i < DataObjectSyncanoClient.MaxAdditionalsCount + 5; ++i)
request.Additional.Add(i.ToString(CultureInfo.InvariantCulture), "additional value");
try
{
//when
await client.Update(request);
throw new Exception("Update should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentException>();
}
}
示例5: Update_WithNullCollectionIdAndKey_ThrowsException
public async Task Update_WithNullCollectionIdAndKey_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
try
{
//when
await client.Update(request, "dataId");
throw new Exception("Update should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentNullException>();
}
}
示例6: Update_ByCollectionId_WithAdditionals_CreatesNewDataObject
public async Task Update_ByCollectionId_WithAdditionals_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var additionals = new Dictionary<string, string>();
additionals.Add("param1", "value1");
additionals.Add("param2", "value2");
additionals.Add("param3", "value3");
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
var dataObject = await client.New(request);
request.Additional = additionals;
//when
var result = await client.Update(request, dataObject.Id);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(request.Folder);
result.Additional.ShouldNotBeNull();
result.Additional.Count.ShouldEqual(additionals.Count);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
deleteRequest.DataId = result.Id;
await client.Delete(deleteRequest);
}
示例7: Update_ByCollectionId_WithFolderName_CreatesNewDataObject
public async Task Update_ByCollectionId_WithFolderName_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var folderClient =
new FolderSyncanoClient(new SyncanoHttpClient(TestData.InstanceName, TestData.BackendAdminApiKey));
var newFolder = await folderClient.New(TestData.ProjectId, "NewFolder", TestData.CollectionId);
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
var dataObject = await client.New(request);
await client.New(request);
request.Folder = newFolder.Name;
//when
var result = await client.Update(request, dataObject.Id);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(newFolder.Name);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
deleteRequest.DataId = result.Id;
await client.Delete(deleteRequest);
await folderClient.Delete(TestData.ProjectId, newFolder.Name, TestData.CollectionId);
}
示例8: Update_ByCollectionId_DeleteImage_CreatesNewDataObject
public async Task Update_ByCollectionId_DeleteImage_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.ImageBase64 = TestData.ImageToBase64("smallSampleImage.png");
var dataObject = await client.New(request);
request.ImageBase64 = null;
//when
var result = await client.Update(request, dataObject.Id);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(request.Folder);
result.Image.ShouldBeNull();
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
deleteRequest.DataId = result.Id;
await client.Delete(deleteRequest);
}