< Summary

Information
Class: Elsa.Identity.Models.ApplicationFilter
Assembly: Elsa.Identity
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Models/ApplicationFilter.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 39
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
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_Id()100%210%
get_ClientId()100%210%
get_Name()100%210%
Apply(...)0%4260%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Models/ApplicationFilter.cs

#LineLine coverage
 1using Elsa.Identity.Entities;
 2
 3namespace Elsa.Identity.Models;
 4
 5/// <summary>
 6/// Represents an application filter.
 7/// </summary>
 8public class ApplicationFilter
 9{
 10    /// <summary>
 11    /// Gets or sets the application ID to filter for.
 12    /// </summary>
 013    public string? Id { get; set; }
 14
 15    /// <summary>
 16    /// Gets or sets the application short ID to filter for.
 17    /// </summary>
 018    public string? ClientId { get; set; }
 19
 20    /// <summary>
 21    /// Gets or sets the application name to filter for.
 22    /// </summary>
 023    public string? Name { get; set; }
 24
 25    /// <summary>
 26    /// Applies the filter to the specified queryable.
 27    /// </summary>
 28    /// <param name="queryable">The queryable.</param>
 29    /// <returns>The filtered queryable.</returns>
 30    public IQueryable<Application> Apply(IQueryable<Application> queryable)
 31    {
 032        var filter = this;
 033        if (filter.Id != null) queryable = queryable.Where(x => x.Id == filter.Id);
 034        if (filter.ClientId != null) queryable = queryable.Where(x => x.ClientId == filter.ClientId);
 035        if (filter.Name != null) queryable = queryable.Where(x => x.Name == filter.Name);
 36
 037        return queryable;
 38    }
 39}