本文整理汇总了C#中Syncano.Net.Api.DataObjectSyncanoClient.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# DataObjectSyncanoClient.Delete方法的具体用法?C# DataObjectSyncanoClient.Delete怎么用?C# DataObjectSyncanoClient.Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Syncano.Net.Api.DataObjectSyncanoClient
的用法示例。
在下文中一共展示了DataObjectSyncanoClient.Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get_ByCollectionKey
public async Task Get_ByCollectionKey(DataObjectSyncanoClient client)
{
//given
var newRequest = new DataObjectDefinitionRequest();
newRequest.ProjectId = TestData.ProjectId;
newRequest.CollectionKey = TestData.CollectionKey;
var dataObject = await client.New(newRequest);
var getRequest = new DataObjectRichQueryRequest();
getRequest.ProjectId = TestData.ProjectId;
getRequest.CollectionKey = TestData.CollectionKey;
//when
var result =
await client.Get(getRequest);
//then
result.ShouldNotBeNull();
result.Any(d => d.Id == dataObject.Id).ShouldBeTrue();
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例2: AddChild_ByCollectionKey
public async Task AddChild_ByCollectionKey(DataObjectSyncanoClient client)
{
//given
var newParentRequest = new DataObjectDefinitionRequest();
newParentRequest.ProjectId = TestData.ProjectId;
newParentRequest.CollectionId = TestData.CollectionId;
var parentObject = await client.New(newParentRequest);
var newChildRequest = new DataObjectDefinitionRequest();
newChildRequest.ProjectId = TestData.ProjectId;
newChildRequest.CollectionId = TestData.CollectionId;
var childObject = await client.New(newChildRequest);
//when
var result =
await
client.AddChild(TestData.ProjectId, parentObject.Id, childObject.Id,
collectionKey: TestData.CollectionKey);
var getResult =
await
client.GetOne(TestData.ProjectId, TestData.CollectionId, dataId: parentObject.Id,
includeChildren: true);
//then
result.ShouldBeTrue();
getResult.Children.ShouldNotBeEmpty();
getResult.Children[0].Id.ShouldEqual(childObject.Id);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例3: New_ByCollectionKey_CreatesNewDataObject
public async Task New_ByCollectionKey_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionKey = TestData.CollectionKey;
//when
var result = await client.New(request);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(request.Folder);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
deleteRequest.DataId = result.Id;
await client.Delete(deleteRequest);
}
示例4: Get_Data1_OrderBy
public async Task Get_Data1_OrderBy(DataObjectSyncanoClient client)
{
//given
var newData1 = new DataObjectDefinitionRequest();
newData1.ProjectId = TestData.ProjectId;
newData1.CollectionId = TestData.CollectionId;
newData1.DataOne = 1002;
var newData2 = new DataObjectDefinitionRequest();
newData2.ProjectId = TestData.ProjectId;
newData2.CollectionId = TestData.CollectionId;
newData2.DataOne = 1001;
var dataObject1 = await client.New(newData1);
var dataObject2 = await client.New(newData2);
var getRequest = new DataObjectRichQueryRequest();
getRequest.ProjectId = TestData.ProjectId;
getRequest.CollectionId = TestData.CollectionId;
getRequest.OrderBy = DataObjectOrderBy.DataOne;
getRequest.Order = DataObjectOrder.Ascending;
getRequest.AddDataFieldFilter(DataObjectSpecialField.DataOne, DataObjectOperator.GreaterThan, 1000);
//when
var result =
await client.Get(getRequest);
//then
result.ShouldNotBeNull();
result.All(d => d.DataOne >1000).ShouldBeTrue();
result.Count.ShouldEqual(2);
result[0].Id.ShouldEqual(dataObject2.Id);
result[1].Id.ShouldEqual(dataObject1.Id);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例5: RemoveParent_ByCollectionId_WithoutParentId
public async Task RemoveParent_ByCollectionId_WithoutParentId(DataObjectSyncanoClient client)
{
//given
var newParentRequest = new DataObjectDefinitionRequest();
newParentRequest.ProjectId = TestData.ProjectId;
newParentRequest.CollectionId = TestData.CollectionId;
var parentObject = await client.New(newParentRequest);
var newChildRequest = new DataObjectDefinitionRequest();
newChildRequest.ProjectId = TestData.ProjectId;
newChildRequest.CollectionId = TestData.CollectionId;
var childObject = await client.New(newChildRequest);
await client.AddChild(TestData.ProjectId, parentObject.Id, childObject.Id, TestData.CollectionId);
//when
var result =
await
client.RemoveParent(TestData.ProjectId, childObject.Id, collectionId: TestData.CollectionId);
var getResult =
await
client.GetOne(TestData.ProjectId, TestData.CollectionId, dataId: parentObject.Id,
includeChildren: true);
//then
result.ShouldBeTrue();
getResult.Children.ShouldBeNull();
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例6: Count_ByCollectionId_MultipleDataObjects_FilterByTextContent
public async Task Count_ByCollectionId_MultipleDataObjects_FilterByTextContent(DataObjectSyncanoClient client)
{
//given
var count = 15;
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
for (int i = 0; i < count; ++i)
await client.New(request);
request.Text = "text content";
for (int i = 0; i < count; ++i)
await client.New(request);
var countRequest = new CountDataObjectRequest();
countRequest.ProjectId = TestData.ProjectId;
countRequest.CollectionId = TestData.CollectionId;
countRequest.Filter = DataObjectContentFilter.Text;
//when
var result = await client.Count(countRequest);
//then
result.ShouldEqual(2*count);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例7: RemoveChild_ByCollectionKey_WithOtherChildren
public async Task RemoveChild_ByCollectionKey_WithOtherChildren(DataObjectSyncanoClient client)
{
//given
var newParentRequest = new DataObjectDefinitionRequest();
newParentRequest.ProjectId = TestData.ProjectId;
newParentRequest.CollectionId = TestData.CollectionId;
var parentObject = await client.New(newParentRequest);
var newOtherRequest = new DataObjectDefinitionRequest();
newOtherRequest.ProjectId = TestData.ProjectId;
newOtherRequest.CollectionId = TestData.CollectionId;
newOtherRequest.ParentId = parentObject.Id;
var otherObject = await client.New(newOtherRequest);
var newChildRequest = new DataObjectDefinitionRequest();
newChildRequest.ProjectId = TestData.ProjectId;
newChildRequest.CollectionId = TestData.CollectionId;
var childObject = await client.New(newChildRequest);
await client.AddChild(TestData.ProjectId, parentObject.Id, childObject.Id, TestData.CollectionId);
//when
var result =
await
client.RemoveChild(TestData.ProjectId, parentObject.Id, childObject.Id,
TestData.CollectionId);
var getResult =
await
client.GetOne(TestData.ProjectId, TestData.CollectionId, dataId: parentObject.Id,
includeChildren: true);
//then
result.ShouldBeTrue();
getResult.Children.ShouldNotBeEmpty();
getResult.Children.Count.ShouldEqual(1);
getResult.Children.Any(d => d.Id == otherObject.Id).ShouldBeTrue();
getResult.Children.Any(d => d.Id == childObject.Id).ShouldBeFalse();
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例8: Merge_ByCollectionId_WithImage_CreatesNewDataObject
public async Task Merge_ByCollectionId_WithImage_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var link = "custom link";
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Link = link;
var dataObject = await client.New(request);
request.ImageBase64 = TestData.ImageToBase64("smallSampleImage.png");
request.Link = null;
//when
var result = await client.Merge(request, dataObject.Id);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(request.Folder);
result.Image.ShouldNotBeNull();
result.Image.ImageWidth.ShouldEqual(300);
result.Image.ImageHeight.ShouldEqual(300);
result.Link.ShouldEqual(link);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
deleteRequest.DataId = result.Id;
await client.Delete(deleteRequest);
}
示例9: Merge_ByCollectionId_WithStateModerated_CreatesNewDataObject
public async Task Merge_ByCollectionId_WithStateModerated_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var link = "custom link";
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Link = link;
var dataObject = await client.New(request);
request.State = DataObjectState.Moderated;
request.Link = null;
//when
var result = await client.Merge(request, dataObject.Id);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(request.Folder);
result.State.ShouldEqual(request.State);
result.Link.ShouldEqual(link);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
deleteRequest.DataId = result.Id;
await client.Delete(deleteRequest);
}
示例10: 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);
}
示例11: Merge_ByCollectionId_WithAdditionals_CreatesNewDataObject
public async Task Merge_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 link = "custom link";
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Link = link;
var dataObject = await client.New(request);
request.Link = null;
request.Additional = additionals;
//when
var result = await client.Merge(request, dataObject.Id);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(request.Folder);
result.Link.ShouldEqual(link);
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);
}
示例12: Count_ByCollectionId
public async Task Count_ByCollectionId(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
await client.New(request);
var countRequest = new CountDataObjectRequest();
countRequest.ProjectId = TestData.ProjectId;
countRequest.CollectionId = TestData.CollectionId;
//when
var result = await client.Count(countRequest);
//then
result.ShouldEqual(1);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例13: GetOne_ChildrenTreeParentHierarchyWithLimit_CreatesNewDataObject
public async Task GetOne_ChildrenTreeParentHierarchyWithLimit_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var newRequest = new DataObjectDefinitionRequest();
newRequest.ProjectId = TestData.ProjectId;
newRequest.CollectionKey = TestData.CollectionKey;
var dataObject = await client.New(newRequest);
newRequest.ParentId = dataObject.Id;
var childObject = await client.New(newRequest);
newRequest.ParentId = childObject.Id;
childObject = await client.New(newRequest);
newRequest.ParentId = childObject.Id;
await client.New(newRequest);
var limit = 2;
//when
var result =
await client.GetOne(TestData.ProjectId, TestData.CollectionId, dataId: dataObject.Id, includeChildren: true, childrenLimit: limit);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(newRequest.Folder);
result.Id.ShouldEqual(dataObject.Id);
result.Children.Count.ShouldEqual(1);
result.Children[0].Children.Count.ShouldEqual(1);
result.Children[0].Children[0].Children.ShouldBeNull();
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例14: GetOne_FilterByDataKey_CreatesNewDataObject
public async Task GetOne_FilterByDataKey_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var newRequest = new DataObjectDefinitionRequest();
newRequest.ProjectId = TestData.ProjectId;
newRequest.CollectionKey = TestData.CollectionKey;
newRequest.DataKey = "testDataKey";
var dataObject = await client.New(newRequest);
//when
var result =
await client.GetOne(TestData.ProjectId, TestData.CollectionId, dataKey: newRequest.DataKey);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(newRequest.Folder);
result.Id.ShouldEqual(dataObject.Id);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
deleteRequest.DataId = result.Id;
await client.Delete(deleteRequest);
}
示例15: GetOne_ChildrenDefaultLimit_CreatesNewDataObject
public async Task GetOne_ChildrenDefaultLimit_CreatesNewDataObject(DataObjectSyncanoClient client)
{
//given
var newRequest = new DataObjectDefinitionRequest();
newRequest.ProjectId = TestData.ProjectId;
newRequest.CollectionKey = TestData.CollectionKey;
var dataObject = await client.New(newRequest);
newRequest.ParentId = dataObject.Id;
for (int i = 0; i < DataObjectSyncanoClient.MaxVauluesPerRequest + 10; ++i)
await client.New(newRequest);
//when
var result =
await client.GetOne(TestData.ProjectId, TestData.CollectionId, dataId: dataObject.Id, includeChildren: true);
//then
result.ShouldNotBeNull();
result.Folder.ShouldEqual(newRequest.Folder);
result.Id.ShouldEqual(dataObject.Id);
result.Children.Count.ShouldEqual(DataObjectSyncanoClient.MaxVauluesPerRequest);
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
await client.Delete(deleteRequest);
}