Consolidate imports by replacing Elsa.Common.Contracts with Elsa.Common and Elsa.Common.Multitenancy. This update streamlines import statements across various modules, improving code readability and maintainability.
20 lines
674 B
C#
20 lines
674 B
C#
using Elsa.Common.Multitenancy;
|
|
using Elsa.Tenants;
|
|
using Elsa.Tenants.Models;
|
|
|
|
namespace Elsa.Testing.Shared.Services;
|
|
|
|
public class TestTenantsProvider(params string[] tenantIds) : ITenantsProvider
|
|
{
|
|
public ValueTask<IEnumerable<Tenant>> ListAsync(CancellationToken cancellationToken = default)
|
|
{
|
|
var tenants = tenantIds.Select(id => new Tenant {Id = id, Name = id});
|
|
return new(tenants);
|
|
}
|
|
|
|
public async ValueTask<Tenant?> FindAsync(TenantFilter filter, CancellationToken cancellationToken = default)
|
|
{
|
|
var query = (await ListAsync(cancellationToken)).AsQueryable();
|
|
return filter.Apply(query).FirstOrDefault();
|
|
}
|
|
} |