本文整理汇总了C#中Syncano.Net.Api.DataObjectSyncanoClient.Get方法的典型用法代码示例。如果您正苦于以下问题:C# DataObjectSyncanoClient.Get方法的具体用法?C# DataObjectSyncanoClient.Get怎么用?C# DataObjectSyncanoClient.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Syncano.Net.Api.DataObjectSyncanoClient
的用法示例。
在下文中一共展示了DataObjectSyncanoClient.Get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: Get_WithToMuchFolders_ThrowsException
public async Task Get_WithToMuchFolders_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectRichQueryRequest();
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.Get(request);
throw new Exception("Get should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentException>();
}
}
示例4: Get_WithToBigLimit_ThrowsException
public async Task Get_WithToBigLimit_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectRichQueryRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Limit = DataObjectSyncanoClient.MaxVauluesPerRequest + 1;
try
{
//when
await client.Get(request);
throw new Exception("Get should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentException>();
}
}
示例5: Get_WithNullCollectionIdAndCollectionKey_ThrowsException
public async Task Get_WithNullCollectionIdAndCollectionKey_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectRichQueryRequest();
request.ProjectId = TestData.ProjectId;
try
{
//when
await client.Get(request);
throw new Exception("Get should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<ArgumentNullException>();
}
}
示例6: Get_WithInvalidProjectId_ThrowsException
public async Task Get_WithInvalidProjectId_ThrowsException(DataObjectSyncanoClient client)
{
//given
var request = new DataObjectRichQueryRequest();
request.ProjectId = "abc";
request.CollectionId = TestData.CollectionId;
try
{
//when
await client.Get(request);
throw new Exception("Get should throw an exception");
}
catch (Exception e)
{
//then
e.ShouldBeType<SyncanoException>();
}
}