當前位置: 首頁>>代碼示例>>C#>>正文


C# DataObjectSyncanoClient.Count方法代碼示例

本文整理匯總了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);
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:35,代碼來源:DataObjectSyncanoClientTests.cs

示例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);
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:30,代碼來源:DataObjectSyncanoClientTests.cs

示例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);
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:53,代碼來源:DataObjectSyncanoClientTests.cs

示例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);
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:33,代碼來源:DataObjectSyncanoClientTests.cs

示例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);
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:34,代碼來源:DataObjectSyncanoClientTests.cs

示例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);
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:24,代碼來源:DataObjectSyncanoClientTests.cs


注:本文中的Syncano.Net.Api.DataObjectSyncanoClient.Count方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。