< Summary

Information
Class: Elsa.Common.Multitenancy.DefaultTenantsProvider
Assembly: Elsa.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Multitenancy/Implementations/DefaultTenantsProvider.cs
Line coverage
50%
Covered lines: 2
Uncovered lines: 2
Coverable lines: 4
Total lines: 23
Line coverage: 50%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
ListAsync(...)100%11100%
FindAsync(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Multitenancy/Implementations/DefaultTenantsProvider.cs

#LineLine coverage
 1using JetBrains.Annotations;
 2
 3namespace Elsa.Common.Multitenancy;
 4
 5/// <summary>
 6/// A tenant provider that provides the default tenant only. To turn on multitenancy, use another implementation.
 7/// </summary>
 8[UsedImplicitly]
 9public class DefaultTenantsProvider : ITenantsProvider
 10{
 211    private readonly Tenant[]  _tenants = { Tenant.Default };
 12
 13    public Task<IEnumerable<Tenant>> ListAsync(CancellationToken cancellationToken = default)
 14    {
 215        return Task.FromResult<IEnumerable<Tenant>>(_tenants);
 16    }
 17
 18    public Task<Tenant?> FindAsync(TenantFilter filter, CancellationToken cancellationToken = default)
 19    {
 020        var queryable = _tenants.AsQueryable();
 021        return Task.FromResult(filter.Apply(queryable).FirstOrDefault());
 22    }
 23}