Fix missing feature dependency
This commit is contained in:
parent
c8d87cd763
commit
b739f5c096
|
|
@ -16,7 +16,7 @@ namespace Elsa.Features;
|
|||
[DependsOn(typeof(MediatorFeature))]
|
||||
[DependsOn(typeof(WorkflowsFeature))]
|
||||
[DependsOn(typeof(FlowchartFeature))]
|
||||
[DependsOn(typeof(WorkflowRuntimeFeature))]
|
||||
[DependsOn(typeof(DefaultWorkflowRuntimeFeature))]
|
||||
[DependsOn(typeof(WorkflowManagementFeature))]
|
||||
public class ElsaFeature : FeatureBase
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,12 +8,19 @@ using Xunit.Abstractions;
|
|||
|
||||
namespace Elsa.Testing.Shared;
|
||||
|
||||
/// <summary>
|
||||
/// A builder that can be used to configure an <see cref="IServiceProvider"/> for testing purposes.
|
||||
/// </summary>
|
||||
public class TestApplicationBuilder
|
||||
{
|
||||
private readonly ITestOutputHelper _testOutputHelper;
|
||||
private readonly ServiceCollection _services;
|
||||
private Action<IModule> _configureElsa;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestApplicationBuilder"/> class.
|
||||
/// </summary>
|
||||
/// <param name="testOutputHelper">The test output helper.</param>
|
||||
public TestApplicationBuilder(ITestOutputHelper testOutputHelper)
|
||||
{
|
||||
_testOutputHelper = testOutputHelper;
|
||||
|
|
@ -30,24 +37,43 @@ public class TestApplicationBuilder
|
|||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the <see cref="IServiceProvider"/>.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="IServiceProvider"/>.</returns>
|
||||
public IServiceProvider Build()
|
||||
{
|
||||
_services.AddElsa(_configureElsa);
|
||||
return _services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures Elsa.
|
||||
/// </summary>
|
||||
/// <param name="configure">The configuration delegate.</param>
|
||||
/// <returns>The <see cref="TestApplicationBuilder"/>.</returns>
|
||||
public TestApplicationBuilder ConfigureElsa(Action<IModule> configure)
|
||||
{
|
||||
_configureElsa += configure;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the service provider.
|
||||
/// </summary>
|
||||
/// <param name="configure">The configuration delegate.</param>
|
||||
/// <returns>The <see cref="TestApplicationBuilder"/>.</returns>
|
||||
public TestApplicationBuilder ConfigureServices(Action<IServiceCollection> configure)
|
||||
{
|
||||
configure(_services);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the service provider to use a <see cref="CapturingTextWriter"/> to capture standard output.
|
||||
/// </summary>
|
||||
/// <param name="capturingTextWriter">The capturing text writer.</param>
|
||||
/// <returns>The <see cref="TestApplicationBuilder"/>.</returns>
|
||||
public TestApplicationBuilder WithCapturingTextWriter(CapturingTextWriter capturingTextWriter)
|
||||
{
|
||||
var combinedTextWriter = new CombinedTextWriter(capturingTextWriter, new XunitConsoleTextWriter(_testOutputHelper));
|
||||
|
|
|
|||
|
|
@ -18,6 +18,16 @@ public static class ModuleExtensions
|
|||
module.Configure(configure);
|
||||
return module;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables the <see cref="WorkflowRuntimeFeature"/> and configures it to use the default workflow runtime.
|
||||
/// </summary>
|
||||
public static IModule UseDefaultWorkflowRuntime(this IModule module, Action<WorkflowRuntimeFeature>? configureRuntime = default, Action<DefaultWorkflowRuntimeFeature>? configureDefaultRuntime = default)
|
||||
{
|
||||
module.Configure(configureRuntime);
|
||||
module.Configure(configureDefaultRuntime);
|
||||
return module;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register the specified workflow type.
|
||||
|
|
|
|||
Loading…
Reference in a new issue