public CollectionRuleConfigureNamedOptions( CollectionRulesConfigurationProvider configurationProvider, ICollectionRuleActionOperations actionOperations, ICollectionRuleTriggerOperations triggerOperations) { _actionOperations = actionOperations; _configurationProvider = configurationProvider; _triggerOperations = triggerOperations; }
public CollectionRulePipeline( ActionListExecutor actionListExecutor, ICollectionRuleTriggerOperations triggerOperations, CollectionRuleContext context, Action startCallback) { _actionListExecutor = actionListExecutor ?? throw new ArgumentNullException(nameof(actionListExecutor)); _context = context ?? throw new ArgumentNullException(nameof(context)); _startCallback = startCallback; _triggerOperations = triggerOperations ?? throw new ArgumentNullException(nameof(triggerOperations)); }
IEnumerable <ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) { ICollectionRuleTriggerOperations triggerOperations = validationContext.GetRequiredService <ICollectionRuleTriggerOperations>(); List <ValidationResult> results = new(); if (!string.IsNullOrEmpty(Type)) { triggerOperations.TryValidateOptions(Type, Settings, validationContext, results); } return(results); }
private async Task ExecuteScenario( TargetFrameworkMoniker tfm, string scenarioName, string collectionRuleName, Action <Tools.Monitor.RootOptions> setup, Func <AppRunner, CollectionRulePipeline, PipelineCallbacks, Task> pipelineCallback, Action <IServiceCollection> servicesCallback = null) { EndpointInfoSourceCallback endpointInfoCallback = new(_outputHelper); EndpointUtilities endpointUtilities = new(_outputHelper); await using ServerSourceHolder sourceHolder = await endpointUtilities.StartServerAsync(endpointInfoCallback); AppRunner runner = new(_outputHelper, Assembly.GetExecutingAssembly(), tfm : tfm); runner.ConnectionMode = DiagnosticPortConnectionMode.Connect; runner.DiagnosticPortPath = sourceHolder.TransportName; runner.ScenarioName = scenarioName; Task <IEndpointInfo> endpointInfoTask = endpointInfoCallback.WaitAddedEndpointInfoAsync(runner, CommonTestTimeouts.StartProcess); await runner.ExecuteAsync(async() => { IEndpointInfo endpointInfo = await endpointInfoTask; await TestHostHelper.CreateCollectionRulesHost( _outputHelper, setup, async host => { ActionListExecutor actionListExecutor = host.Services.GetRequiredService <ActionListExecutor>(); ICollectionRuleTriggerOperations triggerOperations = host.Services.GetRequiredService <ICollectionRuleTriggerOperations>(); IOptionsMonitor <CollectionRuleOptions> optionsMonitor = host.Services.GetRequiredService <IOptionsMonitor <CollectionRuleOptions> >(); ILogger <CollectionRuleService> logger = host.Services.GetRequiredService <ILogger <CollectionRuleService> >(); ISystemClock clock = host.Services.GetRequiredService <ISystemClock>(); PipelineCallbacks callbacks = new(); CollectionRuleContext context = new( collectionRuleName, optionsMonitor.Get(collectionRuleName), endpointInfo, logger, clock, callbacks.NotifyActionsThrottled); await using CollectionRulePipeline pipeline = new( actionListExecutor, triggerOperations, context, callbacks.NotifyPipelineStarted); await pipelineCallback(runner, pipeline, callbacks); Assert.Equal(1, callbacks.StartedCount); }, servicesCallback); }); }