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


C# DataObjectSyncanoClient.Update方法代碼示例

本文整理匯總了C#中Syncano.Net.Api.DataObjectSyncanoClient.Update方法的典型用法代碼示例。如果您正苦於以下問題:C# DataObjectSyncanoClient.Update方法的具體用法?C# DataObjectSyncanoClient.Update怎麽用?C# DataObjectSyncanoClient.Update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Syncano.Net.Api.DataObjectSyncanoClient的用法示例。


在下文中一共展示了DataObjectSyncanoClient.Update方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

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

示例2: Update_WithTooLongAdditionalValue_ThrowsException

        public async Task Update_WithTooLongAdditionalValue_ThrowsException(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            request.Additional = new Dictionary<string, string>();
            request.Additional.Add("additional key", new String('a', DataObjectSyncanoClient.MaxAdditionalValueLenght + 1));

            try
            {
                //when
                await client.Update(request);
                throw new Exception("Update should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType<ArgumentException>();
            }
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:21,代碼來源:DataObjectSyncanoClientUpdateMergeTests.cs

示例3: Update_WithTooLongText_ThrowsException

        public async Task Update_WithTooLongText_ThrowsException(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            request.Text = new String('a', DataObjectSyncanoClient.MaxTextLenght + 1);

            try
            {
                //when
                await client.Update(request);
                throw new Exception("Update should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType<ArgumentException>();
            }
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:20,代碼來源:DataObjectSyncanoClientUpdateMergeTests.cs

示例4: Update_WithTooMuchAdditionals_ThrowsException

        public async Task Update_WithTooMuchAdditionals_ThrowsException(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            request.Additional = new Dictionary<string, string>();
            for (int i = 0; i < DataObjectSyncanoClient.MaxAdditionalsCount + 5; ++i)
                request.Additional.Add(i.ToString(CultureInfo.InvariantCulture), "additional value");

            try
            {
                //when
                await client.Update(request);
                throw new Exception("Update should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType<ArgumentException>();
            }
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:22,代碼來源:DataObjectSyncanoClientUpdateMergeTests.cs

示例5: Update_WithNullCollectionIdAndKey_ThrowsException

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

            try
            {
                //when
                await client.Update(request, "dataId");
                throw new Exception("Update should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType<ArgumentNullException>();
            }
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:18,代碼來源:DataObjectSyncanoClientUpdateMergeTests.cs

示例6: Update_ByCollectionId_WithAdditionals_CreatesNewDataObject

        public async Task Update_ByCollectionId_WithAdditionals_CreatesNewDataObject(DataObjectSyncanoClient client)
        {
            //given
            var additionals = new Dictionary<string, string>();
            additionals.Add("param1", "value1");
            additionals.Add("param2", "value2");
            additionals.Add("param3", "value3");
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            var dataObject = await client.New(request);

            request.Additional = additionals;

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

            //then
            result.ShouldNotBeNull();
            result.Folder.ShouldEqual(request.Folder);
            result.Additional.ShouldNotBeNull();
            result.Additional.Count.ShouldEqual(additionals.Count);

            //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,代碼行數:30,代碼來源:DataObjectSyncanoClientUpdateMergeTests.cs

示例7: Update_ByCollectionId_WithFolderName_CreatesNewDataObject

        public async Task Update_ByCollectionId_WithFolderName_CreatesNewDataObject(DataObjectSyncanoClient client)
        {
            //given
            var folderClient =
                new FolderSyncanoClient(new SyncanoHttpClient(TestData.InstanceName, TestData.BackendAdminApiKey));
            var newFolder = await folderClient.New(TestData.ProjectId, "NewFolder", TestData.CollectionId);
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            var dataObject = await client.New(request);
            await client.New(request);

            request.Folder = newFolder.Name;

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

            //then
            result.ShouldNotBeNull();
            result.Folder.ShouldEqual(newFolder.Name);

            //cleanup
            var deleteRequest = new DataObjectSimpleQueryRequest();
            deleteRequest.ProjectId = TestData.ProjectId;
            deleteRequest.CollectionId = TestData.CollectionId;
            deleteRequest.DataId = result.Id;
            await client.Delete(deleteRequest);
            await folderClient.Delete(TestData.ProjectId, newFolder.Name, TestData.CollectionId);
        }
開發者ID:Syncano,項目名稱:syncano-dotnet,代碼行數:29,代碼來源:DataObjectSyncanoClientUpdateMergeTests.cs

示例8: Update_ByCollectionId_DeleteImage_CreatesNewDataObject

        public async Task Update_ByCollectionId_DeleteImage_CreatesNewDataObject(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            request.ImageBase64 = TestData.ImageToBase64("smallSampleImage.png");
            var dataObject = await client.New(request);

            request.ImageBase64 = null;

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

            //then
            result.ShouldNotBeNull();
            result.Folder.ShouldEqual(request.Folder);
            result.Image.ShouldBeNull();

            //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,代碼行數:26,代碼來源:DataObjectSyncanoClientUpdateMergeTests.cs


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