本文整理匯總了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>();
}
}