当前位置: 首页>>代码示例>>C#>>正文


C# DataRequests.DataObjectSimpleQueryRequest类代码示例

本文整理汇总了C#中Syncano.Net.DataRequests.DataObjectSimpleQueryRequest的典型用法代码示例。如果您正苦于以下问题:C# DataObjectSimpleQueryRequest类的具体用法?C# DataObjectSimpleQueryRequest怎么用?C# DataObjectSimpleQueryRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataObjectSimpleQueryRequest类属于Syncano.Net.DataRequests命名空间,在下文中一共展示了DataObjectSimpleQueryRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:35,代码来源:DataObjectSyncanoClientAddChildRemoveChildTests.cs

示例2: 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);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:26,代码来源:DataObjectSyncanoClientTests.cs

示例3: Update_ByCollectionId_WithUserName_CreatesNewDataObject

        public async Task Update_ByCollectionId_WithUserName_CreatesNewDataObject(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            var dataObject = await client.New(request);

            request.UserName = TestData.UserName;

            //when
            var result = await client.Update(request, dataObject.Id);

            //then
            result.ShouldNotBeNull();
            result.Folder.ShouldEqual(request.Folder);
            result.User.Name.ShouldEqual(request.UserName);

            //cleanup
            var deleteRequest = new DataObjectSimpleQueryRequest();
            deleteRequest.ProjectId = TestData.ProjectId;
            deleteRequest.CollectionId = TestData.CollectionId;
            deleteRequest.DataId = result.Id;
            await client.Delete(deleteRequest);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:25,代码来源:DataObjectSyncanoClientUpdateMergeTests.cs

示例4: 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);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:21,代码来源:DataObjectSyncanoClientNewDeleteTests.cs

示例5: 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);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:40,代码来源:DataObjectSyncanoClientQueryTests.cs

示例6: RemoveChild_WithNullChildId_RemovesAllChildren

        public async Task RemoveChild_WithNullChildId_RemovesAllChildren(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.RemoveChild(TestData.ProjectId, parentObject.Id, collectionId: TestData.CollectionId);

            //then
            result.ShouldBeTrue();

            //cleanup
            var deleteRequest = new DataObjectSimpleQueryRequest();
            deleteRequest.ProjectId = TestData.ProjectId;
            deleteRequest.CollectionId = TestData.CollectionId;
            await client.Delete(deleteRequest);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:27,代码来源:DataObjectSyncanoClientAddChildRemoveChildTests.cs

示例7: RemoveChild_WithInvalidChildId_ThrowsException

        public async Task RemoveChild_WithInvalidChildId_ThrowsException(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);

            try
            {
                //when
                await client.RemoveChild(TestData.ProjectId, parentObject.Id, "abc", TestData.CollectionId);
                throw new Exception("RemoveChild should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType<SyncanoException>();
            }
            //cleanup
            var deleteRequest = new DataObjectSimpleQueryRequest();
            deleteRequest.ProjectId = TestData.ProjectId;
            deleteRequest.CollectionId = TestData.CollectionId;
            await client.Delete(deleteRequest);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:32,代码来源:DataObjectSyncanoClientAddChildRemoveChildTests.cs

示例8: DeleteObjectSync

        public async void DeleteObjectSync()
        {
            var dataObject = DataObjectsSync[SelectedSync];
            DataObjectsHttp.Remove(dataObject);
            SelectedSync = -1;

            var request = new DataObjectSimpleQueryRequest
            {
                ProjectId = ProjectId,
                CollectionId = CollectionId,
                Folder = FolderName,
                DataId = dataObject.Id
            };

            await _syncServer.DataObjects.Delete(request);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:16,代码来源:MainWindowViewModel.cs

示例9: 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);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:25,代码来源:DataObjectSyncanoClientTests.cs

示例10: Merge_ByCollectionId_WithLink_CreatesNewDataObject

        public async Task Merge_ByCollectionId_WithLink_CreatesNewDataObject(DataObjectSyncanoClient client)
        {
            //given
            var title = "title";
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            request.Title = title;
            var dataObject = await client.New(request);

            request.Link = "dataObject link";
            request.Title = null;

            //when
            var result = await client.Merge(request, dataObject.Id);

            //then
            result.ShouldNotBeNull();
            result.Folder.ShouldEqual(request.Folder);
            result.Link.ShouldEqual(request.Link);
            result.Title.ShouldEqual(title);

            //cleanup
            var deleteRequest = new DataObjectSimpleQueryRequest();
            deleteRequest.ProjectId = TestData.ProjectId;
            deleteRequest.CollectionId = TestData.CollectionId;
            deleteRequest.DataId = result.Id;
            await client.Delete(deleteRequest);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:29,代码来源:DataObjectSyncanoClientUpdateMergeTests.cs

示例11: 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);
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:29,代码来源:DataObjectSyncanoClientUpdateMergeTests.cs

示例12: Move_WithToMuchFolders_ThrowsException

        public async Task Move_WithToMuchFolders_ThrowsException(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectSimpleQueryRequest();
            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.Move(request);
                throw new Exception("Move should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType<ArgumentException>();
            }
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:23,代码来源:DataObjectSyncanoClientTests.cs

示例13: 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

示例14: Move_WithNullCollectionIdAndCollectionKey_ThrowsException

        public async Task Move_WithNullCollectionIdAndCollectionKey_ThrowsException(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectSimpleQueryRequest();
            request.ProjectId = TestData.ProjectId;

            try
            {
                //when
                await client.Move(request);
                throw new Exception("Move should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType<ArgumentNullException>();
            }
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:18,代码来源:DataObjectSyncanoClientTests.cs

示例15: Move_WithToBigLimit_ThrowsException

        public async Task Move_WithToBigLimit_ThrowsException(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectSimpleQueryRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            request.Limit = DataObjectSyncanoClient.MaxVauluesPerRequest + 1;

            try
            {
                //when
                await client.Move(request);
                throw new Exception("Move should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType<ArgumentException>();
            }
        }
开发者ID:Syncano,项目名称:syncano-dotnet,代码行数:20,代码来源:DataObjectSyncanoClientTests.cs


注:本文中的Syncano.Net.DataRequests.DataObjectSimpleQueryRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。