Esempio n. 1
0
        public async Task ShouldGetBusinessProcessDetails()
        {
            // Arrange

            // 1. Create or update schema
            var schemas = await _client.Schema.GenerateSchemasAsync(typeof(BusinessProcessTest)).ConfigureAwait(false);

            await _client.Schema.CreateOrUpdateAsync(schemas.First(), false, TimeSpan.FromMinutes(1)).ConfigureAwait(false);

            // 2. Create list items
            var listItemDetail1 = await _client.ListItem.CreateAsync(new ListItemCreateRequest
            {
                Content = new BusinessProcessTest {
                    Name = "Test1"
                },
                ContentSchemaId = nameof(BusinessProcessTest)
            }).ConfigureAwait(false);

            var listItemDetail2 = await _client.ListItem.CreateAsync(new ListItemCreateRequest
            {
                Content = new BusinessProcessTest {
                    Name = "Test2"
                },
                ContentSchemaId = nameof(BusinessProcessTest)
            }).ConfigureAwait(false);

            // 3. Initialize change request
            var updateRequest = new ListItemFieldsBatchUpdateRequest
            {
                ListItemIds = new List <string>
                {
                    listItemDetail1.Id,
                    listItemDetail2.Id
                },
                ChangeCommands = new List <MetadataValuesChangeCommandBase>
                {
                    new MetadataValuesSchemaUpdateCommand
                    {
                        SchemaId = nameof(BusinessProcessTest),
                        Value    = new DataDictionary
                        {
                            { "Description", "TestDescription" }
                        }
                    }
                }
            };

            var result = await _client.ListItem.BatchUpdateFieldsByIdsAsync(updateRequest).ConfigureAwait(false);

            // Act
            var details = await _client.BusinessProcess.GetDetailsAsync(result.BusinessProcessId).ConfigureAwait(false);

            // Assert
            Assert.True(details.LifeCycle == BusinessProcessLifeCycle.Succeeded);
        }
Esempio n. 2
0
        /// <inheritdoc />
        public async Task <ListItemBatchOperationResult> BatchUpdateFieldsByIdsAsync(ListItemFieldsBatchUpdateRequest updateRequest, TimeSpan?timeout = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            var businessProcess = await BatchUpdateFieldsByIdsCoreAsync(updateRequest, cancellationToken).ConfigureAwait(false);

            return(await WaitForBusinessProcessAndReturnResult(businessProcess.Id, timeout, cancellationToken).ConfigureAwait(false));
        }