public WorkflowExecutorFixture() { Host = A.Fake <IWorkflowHost>(); PersistenceProvider = A.Fake <IPersistenceProvider>(); ServiceProvider = A.Fake <IServiceProvider>(); ScopeProvider = A.Fake <IScopeProvider>(); Registry = A.Fake <IWorkflowRegistry>(); ResultProcesser = A.Fake <IExecutionResultProcessor>(); EventHub = A.Fake <ILifeCycleEventPublisher>(); CancellationProcessor = A.Fake <ICancellationProcessor>(); DateTimeProvider = A.Fake <IDateTimeProvider>(); Options = new WorkflowOptions(A.Fake <IServiceCollection>()); var scope = A.Fake <IServiceScope>(); A.CallTo(() => ScopeProvider.CreateScope(A <IStepExecutionContext> ._)).Returns(scope); A.CallTo(() => scope.ServiceProvider).Returns(ServiceProvider); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); A.CallTo(() => DateTimeProvider.UtcNow).Returns(DateTime.UtcNow); //config logging var loggerFactory = new LoggerFactory(); //loggerFactory.AddConsole(LogLevel.Debug); Subject = new WorkflowExecutor(Registry, ServiceProvider, ScopeProvider, DateTimeProvider, ResultProcesser, EventHub, CancellationProcessor, Options, loggerFactory); }
public WorkflowExecutorFixture() { //setup dependency injection IServiceCollection services = new ServiceCollection(); services.AddLogging(); //TODO: mock these dependencies to make true unit tests Options = new WorkflowOptions(); services.AddSingleton(Options); services.AddTransient <IWorkflowBuilder, WorkflowBuilder>(); services.AddTransient <IWorkflowRegistry, WorkflowRegistry>(); services.AddTransient <IExecutionResultProcessor, ExecutionResultProcessor>(); services.AddTransient <IExecutionPointerFactory, ExecutionPointerFactory>(); services.AddTransient <IDateTimeProvider, DateTimeProvider>(); Host = A.Fake <IWorkflowHost>(); PersistenceProvider = A.Fake <IPersistenceProvider>(); var serviceProvider = services.BuildServiceProvider(); //config logging var loggerFactory = serviceProvider.GetService <ILoggerFactory>(); loggerFactory.AddConsole(LogLevel.Debug); Registry = serviceProvider.GetService <IWorkflowRegistry>(); ResultProcesser = serviceProvider.GetService <IExecutionResultProcessor>(); Subject = new WorkflowExecutor(Registry, serviceProvider, new DateTimeProvider(), ResultProcesser, Options, loggerFactory); }
public WorkflowExecutorFixture() { Host = A.Fake <IWorkflowHost>(); PersistenceProvider = A.Fake <IPersistenceProvider>(); ServiceProvider = A.Fake <IServiceProvider>(); ScopeProvider = A.Fake <IScopeProvider>(); Registry = A.Fake <IWorkflowRegistry>(); ResultProcesser = A.Fake <IExecutionResultProcessor>(); EventHub = A.Fake <ILifeCycleEventPublisher>(); CancellationProcessor = A.Fake <ICancellationProcessor>(); DateTimeProvider = A.Fake <IDateTimeProvider>(); MiddlewareRunner = A.Fake <IWorkflowMiddlewareRunner>(); StepExecutor = A.Fake <IStepExecutor>(); Options = new WorkflowOptions(A.Fake <IServiceCollection>()); var stepExecutionScope = A.Fake <IServiceScope>(); A.CallTo(() => ScopeProvider.CreateScope(A <IStepExecutionContext> ._)).Returns(stepExecutionScope); A.CallTo(() => stepExecutionScope.ServiceProvider).Returns(ServiceProvider); var scope = A.Fake <IServiceScope>(); var scopeFactory = A.Fake <IServiceScopeFactory>(); A.CallTo(() => ServiceProvider.GetService(typeof(IServiceScopeFactory))).Returns(scopeFactory); A.CallTo(() => scopeFactory.CreateScope()).Returns(scope); A.CallTo(() => scope.ServiceProvider).Returns(ServiceProvider); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); A.CallTo(() => DateTimeProvider.UtcNow).Returns(DateTime.UtcNow); A .CallTo(() => ServiceProvider.GetService(typeof(IWorkflowMiddlewareRunner))) .Returns(MiddlewareRunner); A .CallTo(() => ServiceProvider.GetService(typeof(IStepExecutor))) .Returns(StepExecutor); A.CallTo(() => MiddlewareRunner .RunPostMiddleware(A <WorkflowInstance> ._, A <WorkflowDefinition> ._)) .Returns(Task.CompletedTask); A.CallTo(() => MiddlewareRunner .RunExecuteMiddleware(A <WorkflowInstance> ._, A <WorkflowDefinition> ._)) .Returns(Task.CompletedTask); A.CallTo(() => StepExecutor.ExecuteStep(A <IStepExecutionContext> ._, A <IStepBody> ._)) .ReturnsLazily(call => call.Arguments[1].As <IStepBody>().RunAsync( call.Arguments[0].As <IStepExecutionContext>())); //config logging var loggerFactory = new LoggerFactory(); //loggerFactory.AddConsole(LogLevel.Debug); Subject = new WorkflowExecutor(Registry, ServiceProvider, ScopeProvider, DateTimeProvider, ResultProcesser, EventHub, CancellationProcessor, Options, loggerFactory); }
public WorkflowExecutor(IWorkflowRegistry registry, IServiceProvider serviceProvider, IExecutionResultProcessor executionResultProcessor, WorkflowOptions options, ILoggerFactory loggerFactory) { _serviceProvider = serviceProvider; _registry = registry; _options = options; _logger = loggerFactory.CreateLogger <WorkflowExecutor>(); _executionResultProcessor = executionResultProcessor; }
public WorkflowExecutor(IWorkflowRegistry registry, IServiceProvider serviceProvider, IDateTimeProvider datetimeProvider, IExecutionResultProcessor executionResultProcessor, ILifeCycleEventPublisher publisher, WorkflowOptions options, ILoggerFactory loggerFactory) { _serviceProvider = serviceProvider; _registry = registry; _datetimeProvider = datetimeProvider; _publisher = publisher; _options = options; _logger = loggerFactory.CreateLogger <WorkflowExecutor>(); _executionResultProcessor = executionResultProcessor; }
public WorkflowExecutor(IWorkflowRegistry registry, IServiceProvider serviceProvider, IDateTimeProvider datetimeProvider, IExecutionResultProcessor executionResultProcessor, WorkflowOptions options, ILoggerFactory loggerFactory, IPersistenceProvider persistenceStore) { _serviceProvider = serviceProvider; _registry = registry; _datetimeProvider = datetimeProvider; _options = options; _logger = loggerFactory.CreateLogger <WorkflowExecutor>(); _executionResultProcessor = executionResultProcessor; _persistenceStore = persistenceStore; }
public WorkflowExecutor(IWorkflowRegistry registry, IServiceProvider serviceProvider, IScopeProvider scopeProvider, IDateTimeProvider datetimeProvider, IExecutionResultProcessor executionResultProcessor, ILifeCycleEventPublisher publisher, ICancellationProcessor cancellationProcessor, WorkflowOptions options, IWorkflowMiddlewareRunner middlewareRunner, IStepExecutor stepExecutor, ILoggerFactory loggerFactory) { _serviceProvider = serviceProvider; _scopeProvider = scopeProvider; _registry = registry; _datetimeProvider = datetimeProvider; _publisher = publisher; _cancellationProcessor = cancellationProcessor; _options = options; _logger = loggerFactory.CreateLogger <WorkflowExecutor>(); _executionResultProcessor = executionResultProcessor; _middlewareRunner = middlewareRunner; _stepExecutor = stepExecutor; }
public ExecutionResultProcessorFixture() { PointerFactory = A.Fake <IExecutionPointerFactory>(); DateTimeProvider = A.Fake <IClockProvider>(); Options = new WorkflowOptions(); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); //config logging var loggerFactory = new LoggerFactory(); Subject = new ExecutionResultProcessor(PointerFactory, Options, loggerFactory); }
public ExecutionResultProcessorFixture() { PointerFactory = A.Fake <IExecutionPointerFactory>(); DateTimeProvider = A.Fake <IDateTimeProvider>(); Options = new WorkflowOptions(A.Fake <IServiceCollection>()); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); //config logging var loggerFactory = new LoggerFactory(); loggerFactory.AddConsole(LogLevel.Debug); Subject = new ExecutionResultProcessor(PointerFactory, DateTimeProvider, Options, loggerFactory); }
public ExecutionResultProcessorFixture() { PointerFactory = A.Fake <IExecutionPointerFactory>(); DateTimeProvider = A.Fake <IDateTimeProvider>(); EventHub = A.Fake <ILifeCycleEventPublisher>(); ErrorHandlers = new HashSet <IWorkflowErrorHandler>(); Options = new WorkflowOptions(A.Fake <IServiceCollection>()); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); //config logging var loggerFactory = new LoggerFactory(); loggerFactory.AddConsole(LogLevel.Debug); Subject = new ExecutionResultProcessor(PointerFactory, DateTimeProvider, EventHub, ErrorHandlers, Options, loggerFactory); }
public WorkflowExecutorFixture() { Host = A.Fake <IWorkflowHost>(); PersistenceProvider = A.Fake <IPersistenceProvider>(); ServiceProvider = A.Fake <IServiceProvider>(); Registry = A.Fake <IWorkflowRegistry>(); ResultProcesser = A.Fake <IExecutionResultProcessor>(); DateTimeProvider = A.Fake <IClockProvider>(); Options = new WorkflowOptions(); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); //config logging var loggerFactory = new LoggerFactory(); Subject = new WorkflowExecutor(Registry, ServiceProvider, ResultProcesser, Options, loggerFactory); }
public WorkflowExecutorFixture() { Host = A.Fake <IWorkflowHost>(); PersistenceProvider = A.Fake <IPersistenceProvider>(); ServiceProvider = A.Fake <IServiceProvider>(); Registry = A.Fake <IWorkflowRegistry>(); ResultProcesser = A.Fake <IExecutionResultProcessor>(); DateTimeProvider = A.Fake <IDateTimeProvider>(); Options = new WorkflowOptions(A.Fake <IServiceCollection>()); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); //config logging var loggerFactory = new LoggerFactory(); loggerFactory.AddConsole(LogLevel.Debug); Subject = new WorkflowExecutor(Registry, ServiceProvider, DateTimeProvider, ResultProcesser, Options, loggerFactory, PersistenceProvider); }
public CancellationProcessor(IExecutionResultProcessor executionResultProcessor, ILoggerFactory logFactory, IDateTimeProvider dateTimeProvider) { _executionResultProcessor = executionResultProcessor; _logger = logFactory.CreateLogger <CancellationProcessor>(); _dateTimeProvider = dateTimeProvider; }
public CancellationProcessor(IExecutionResultProcessor executionResultProcessor, ILoggerFactory logFactory) { _executionResultProcessor = executionResultProcessor; _logger = logFactory.CreateLogger <CancellationProcessor>(); }