< Summary

Information
Class: Elsa.ExternalAuthentication.Providers.DatabaseIdentityProviderConnectionSource
Assembly: Elsa.ExternalAuthentication
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Providers/DatabaseIdentityProviderConnectionSource.cs
Line coverage
50%
Covered lines: 6
Uncovered lines: 6
Coverable lines: 12
Total lines: 30
Line coverage: 50%
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
.ctor(...)100%11100%
get_Name()100%11100%
get_Ownership()100%11100%
GetSnapshotAsync()0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Providers/DatabaseIdentityProviderConnectionSource.cs

#LineLine coverage
 1using Elsa.ExternalAuthentication.Contracts;
 2using Elsa.ExternalAuthentication.Models;
 3using Elsa.ExternalAuthentication.Options;
 4using Microsoft.Extensions.Options;
 5
 6namespace Elsa.ExternalAuthentication.Providers;
 7
 8/// <summary>
 9/// Projects optional database-owned rows into the effective registry. The backing store is deliberately replaceable.
 10/// </summary>
 111public sealed class DatabaseIdentityProviderConnectionSource(
 112    IIdentityProviderConnectionStore store,
 113    IConnectionRegistryVersionStore versions,
 114    IOptionsMonitor<ExternalAuthenticationOptions> options) : IIdentityProviderConnectionSource
 15{
 16    public const string SourceName = "database";
 17
 118    public string Name => SourceName;
 119    public ConnectionSourceOwnership Ownership => ConnectionSourceOwnership.Database;
 20
 21    public async ValueTask<ConnectionSourceSnapshot> GetSnapshotAsync(ConnectionScope scope, CancellationToken cancellat
 22    {
 023        if (!options.CurrentValue.EnableDatabaseConnections)
 024            return new ConnectionSourceSnapshot(scope, "disabled", []);
 25
 026        var page = await store.FindAsync(new ConnectionFilter { Scope = scope }, cancellationToken);
 027        var version = await versions.GetVersionAsync(cancellationToken);
 028        return new ConnectionSourceSnapshot(scope, version.ToString(System.Globalization.CultureInfo.InvariantCulture), 
 029    }
 30}