示例#1
0
        public async Task GetMiddlewarePipelineAdditions_Returns_On_All_Sources_Processed()
        {
            _lcManager.NotifyExpectedMiddlewareSource();
            _lcManager.NotifyExpectedMiddlewareSource();

            var result = _lcManager.GetMiddlewarePipelineAdditions(_token);
            await Task.Delay(ProcessingAllowanceDelay);

            Assert.False(result.IsCompleted);

            _lcManager.NotifyMiddlewareSourceProcessed();
            await Task.Delay(ProcessingAllowanceDelay);

            Assert.False(result.IsCompleted);

            _lcManager.NotifyMiddlewareSourceProcessed();
            await Task.Delay(ProcessingAllowanceDelay);

            Assert.True(result.IsCompletedSuccessfully);
        }
示例#2
0
        private async Task InsertRequestPipelineMiddlewareRegistrations()
        {
            try
            {
                var pipelineAdditions = await _taskManager.ManagedRun(_taskId, (token) => _lifecycleManager.GetMiddlewarePipelineAdditions(token));

                _configureMethodStatements = _configureMethodStatements.Concat(pipelineAdditions);
            }
            catch (OperationCanceledException e)
            {
                LogHelper.LogError(e, string.Format(
                                       Constants.CaneledServiceCallLogTemplate,
                                       Rules.Config.Constants.WebFormsErrorTag,
                                       GetType().Name,
                                       typeof(LifecycleManagerService).Name,
                                       GetMiddlewarePipelineAdditionsLogCall));

                var failureComment = string.Format(Constants.OperationFailedCommentTemplate, ConfigureRequestPipelineOperation);

                if (!_configureMethodStatements.Any())
                {
                    // If we don't have any extra statements for configure() add a blank
                    // one to attach our comment to
                    _configureMethodStatements = _configureMethodStatements.Append(CodeSyntaxHelper.GetBlankLine().AddComment(failureComment, isLeading: false));
                }
                else
                {
                    _configureMethodStatements = _configureMethodStatements.AddComment(failureComment, isLeading: false);
                }
            }
        }