2021-03-06 13:55:19 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using AutoFixture.Kernel;
|
|
|
|
|
using Elsa.Testing.Shared.AutoFixture.SpecimenBuilders;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace Elsa.Testing.Shared.AutoFixture.Customizations
|
|
|
|
|
{
|
2021-03-13 15:21:44 +00:00
|
|
|
public class HostBubilderUsingServicesCustomization : SpecimenBuilderForParameterCustomization
|
2021-03-06 13:55:19 +00:00
|
|
|
{
|
|
|
|
|
readonly Action<IServiceCollection> serviceConfig;
|
|
|
|
|
|
2021-03-13 15:21:44 +00:00
|
|
|
protected override ISpecimenBuilder GetUnfilteredSpecimenBuilder()
|
|
|
|
|
=> new HostBubilderUsingServicesSpecimenBuilder(serviceConfig);
|
2021-03-06 13:55:19 +00:00
|
|
|
|
|
|
|
|
public HostBubilderUsingServicesCustomization(Action<IServiceCollection> serviceConfig,
|
2021-03-13 15:21:44 +00:00
|
|
|
ParameterInfo? parameter) : base(parameter)
|
2021-03-06 13:55:19 +00:00
|
|
|
{
|
|
|
|
|
this.serviceConfig = serviceConfig ?? throw new ArgumentNullException(nameof(serviceConfig));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|