As well as providing a unit test which matches other persistence provider tests (round-tripping a workflow instance), two other tests are included here: * When using the default DI registration extension method, this sets up pooling of DB contexts and so a resolved context will come from the pool. * When using the non-pooled DI registration extension method, this sets up EF without pooling, which is more useful in a multi-tenanted environment. There are also some other changes in this commit corresponding to improving the tests. Mainly de-duplicating logic & improving names.
23 lines
892 B
C#
23 lines
892 B
C#
using System;
|
|
using System.Reflection;
|
|
using AutoFixture;
|
|
using AutoFixture.Kernel;
|
|
using Elsa.Testing.Shared.AutoFixture.SpecimenBuilders;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Elsa.Testing.Shared.AutoFixture.Customizations
|
|
{
|
|
public class HostBubilderUsingServicesCustomization : SpecimenBuilderForParameterCustomization
|
|
{
|
|
readonly Action<IServiceCollection> serviceConfig;
|
|
|
|
protected override ISpecimenBuilder GetUnfilteredSpecimenBuilder()
|
|
=> new HostBubilderUsingServicesSpecimenBuilder(serviceConfig);
|
|
|
|
public HostBubilderUsingServicesCustomization(Action<IServiceCollection> serviceConfig,
|
|
ParameterInfo? parameter) : base(parameter)
|
|
{
|
|
this.serviceConfig = serviceConfig ?? throw new ArgumentNullException(nameof(serviceConfig));
|
|
}
|
|
}
|
|
} |