本文整理汇总了C#中Syncano.Net.Api.DataObjectSyncanoClient.Count方法的典型用法代码示例。如果您正苦于以下问题:C# DataObjectSyncanoClient.Count方法的具体用法?C# DataObjectSyncanoClient.Count怎么用?C# DataObjectSyncanoClient.Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Syncano.Net.Api.DataObjectSyncanoClient
的用法示例。
在下文中一共展示了DataObjectSyncanoClient.Count方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Count_WithToMuchFolders_ThrowsException
public async Task Count_WithToMuchFolders_ThrowsException(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;
countRequest.Folders = new List<string>();
for (int i = 0; i < DataObjectSyncanoClient.MaxVauluesPerRequest; ++i)
countRequest.Folders.Add("folder");
countRequest.Folder = "folder";
try
{
//when
await client.Count(countRequest);
throw new Exception("Count should throw an exception");
}
catch (Exception e)
{
e.ShouldBeType<ArgumentException>();
}
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例2: Count_WithInvalidCollectionId_ThrowsException
public async Task Count_WithInvalidCollectionId_ThrowsException(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 = "abc";
try
{
//when
await client.Count(countRequest);
throw new Exception("Count should throw an exception");
}
catch (Exception e)
{
e.ShouldBeType<SyncanoException>();
}
//cleanup
var deleteRequest = new DataObjectSimpleQueryRequest();
deleteRequest.ProjectId = TestData.ProjectId;
deleteRequest.CollectionId = TestData.CollectionId;
await client.Delete(deleteRequest);
}
示例3: Count_ByCollectionId_MultipleDataObjects_FilterByFoldersUsingFolderAndFoldersList
public async Task Count_ByCollectionId_MultipleDataObjects_FilterByFoldersUsingFolderAndFoldersList(DataObjectSyncanoClient client)
{
//given
var folderClient =
new FolderSyncanoClient(new SyncanoHttpClient(TestData.InstanceName, TestData.BackendAdminApiKey));
var folderOne =
await folderClient.New(TestData.ProjectId, "folderOne", collectionId: TestData.CollectionId);
var folderTwo =
await folderClient.New(TestData.ProjectId, "folderTwo", collectionId: TestData.CollectionId);
var folderThree =
await folderClient.New(TestData.ProjectId, "foldeThree", collectionId: TestData.CollectionId);
var count = 15;
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.Folder = folderOne.Name;
for (int i = 0; i < count; ++i)
await client.New(request);
request.Folder = folderTwo.Name;
for (int i = 0; i < count; ++i)
await client.New(request);
request.Folder = folderThree.Name;
for (int i = 0; i < count; ++i)
await client.New(request);
var countRequest = new CountDataObjectRequest();
countRequest.ProjectId = TestData.ProjectId;
countRequest.CollectionId = TestData.CollectionId;
countRequest.Folders = new List<string> { folderOne.Name };
countRequest.Folder = folderTwo.Name;
//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);
await folderClient.Delete(TestData.ProjectId, folderOne.Name, TestData.CollectionId);
await folderClient.Delete(TestData.ProjectId, folderTwo.Name, TestData.CollectionId);
await folderClient.Delete(TestData.ProjectId, folderThree.Name, TestData.CollectionId);
}
示例4: 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);
}
示例5: Count_ByCollectionId_MultipleDataObjects_FilterByStateAll
public async Task Count_ByCollectionId_MultipleDataObjects_FilterByStateAll(DataObjectSyncanoClient client)
{
//given
var count = 15;
var request = new DataObjectDefinitionRequest();
request.ProjectId = TestData.ProjectId;
request.CollectionId = TestData.CollectionId;
request.State = DataObjectState.Rejected;
for (int i = 0; i < count; ++i)
await client.New(request);
request.State = DataObjectState.Moderated;
for (int i = 0; i < count; ++i)
await client.New(request);
var countRequest = new CountDataObjectRequest();
countRequest.ProjectId = TestData.ProjectId;
countRequest.CollectionId = TestData.CollectionId;
countRequest.State = DataObjectState.All;
//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);
}
示例6: 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);
}