using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services; namespace Microsoft.Extensions.DependencyInjection; internal static class ConfigurationTransactionTestExtensions { /// Registers a scope-per-call configuration command transaction and the area service for tests. /// The service collection to add the registrations to. /// The same service collection, for chaining. public static ServiceCollection AddTestConfigurationTransaction(this ServiceCollection services) { services.AddSingleton(); services.AddScoped(); return services; } private sealed class RepositoryTransaction(IServiceScopeFactory scopes) : IConfigurationCommandTransaction { /// public async Task ExecuteAsync(Func> operation) { using var scope = scopes.CreateScope(); return await operation(scope.ServiceProvider); } } }