< Summary

Information
Class: Elsa.Identity.Providers.ConfigurationBasedApplicationProvider
Assembly: Elsa.Identity
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Providers/ConfigurationBasedApplicationProvider.cs
Line coverage
50%
Covered lines: 3
Uncovered lines: 3
Coverable lines: 6
Total lines: 33
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%
FindAsync(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Providers/ConfigurationBasedApplicationProvider.cs

#LineLine coverage
 1using Elsa.Identity.Contracts;
 2using Elsa.Identity.Entities;
 3using Elsa.Identity.Models;
 4using Elsa.Identity.Options;
 5using JetBrains.Annotations;
 6using Microsoft.Extensions.Options;
 7
 8namespace Elsa.Identity.Providers;
 9
 10/// <summary>
 11/// Represents an application provider that uses <see cref="ApplicationsOptions"/> to find applications.
 12/// </summary>
 13[PublicAPI]
 14public class ConfigurationBasedApplicationProvider : IApplicationProvider
 15{
 16    private readonly IOptions<ApplicationsOptions> _options;
 17
 18    /// <summary>
 19    /// Initializes a new instance of the <see cref="ConfigurationBasedApplicationProvider"/> class.
 20    /// </summary>
 121    public ConfigurationBasedApplicationProvider(IOptions<ApplicationsOptions> options)
 22    {
 123        _options = options;
 124    }
 25
 26    /// <inheritdoc />
 27    public Task<Application?> FindAsync(ApplicationFilter filter, CancellationToken cancellationToken = default)
 28    {
 029        var applicationsQueryable = _options.Value.Applications.AsQueryable();
 030        var application = filter.Apply(applicationsQueryable).FirstOrDefault();
 031        return Task.FromResult(application);
 32    }
 33}