< Summary

Information
Class: Elsa.Common.Multitenancy.TenantResolverResult
Assembly: Elsa.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Multitenancy/Results/TenantResolverResult.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 28
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_TenantId()100%210%
Resolved(...)100%210%
Unresolved()100%210%
get_IsResolved()100%210%
ResolveTenantId()0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Multitenancy/Results/TenantResolverResult.cs

#LineLine coverage
 1namespace Elsa.Common.Multitenancy;
 2
 3/// <summary>
 4/// Represents the result of a tenant resolution.
 5/// </summary>
 6/// <param name="TenantId">The resolved tenant.</param>
 07public record TenantResolverResult(string? TenantId)
 8{
 9    /// <summary>
 10    /// Creates a new instance of <see cref="TenantResolverResult"/> representing a resolved tenant.
 11    /// </summary>
 12    /// <param name="tenantId">The resolved tenant.</param>
 13    /// <returns>A new instance of <see cref="TenantResolverResult"/> representing a resolved tenant.</returns>
 014    public static TenantResolverResult Resolved(string tenantId) => new(tenantId);
 15
 16    /// <summary>
 17    /// Creates a new instance of <see cref="TenantResolverResult"/> representing an unresolved tenant.
 18    /// </summary>
 19    /// <returns>A new instance of <see cref="TenantResolverResult"/> representing an unresolved tenant.</returns>
 020    public static TenantResolverResult Unresolved() => new(default(string?));
 21
 22    /// <summary>
 23    /// Gets a value indicating whether the tenant has been resolved.
 24    /// </summary>
 025    public bool IsResolved => TenantId != null;
 26
 027    public string ResolveTenantId() => TenantId ?? throw new InvalidOperationException("Tenant has not been resolved.");
 28}