< Summary

Information
Class: Elsa.Identity.Models.UserFilter
Assembly: Elsa.Identity
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Models/UserFilter.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 33
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
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_Name()100%210%
Apply(...)0%2040%

File(s)

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

#LineLine coverage
 1using Elsa.Identity.Entities;
 2
 3namespace Elsa.Identity.Models;
 4
 5/// <summary>
 6/// Represents a user filter.
 7/// </summary>
 8public class UserFilter
 9{
 10    /// <summary>
 11    /// Gets or sets the user ID to filter for.
 12    /// </summary>
 013    public string? Id { get; set; }
 14
 15    /// <summary>
 16    /// Gets or sets the user name to filter for.
 17    /// </summary>
 018    public string? Name { get; set; }
 19
 20    /// <summary>
 21    /// Applies the filter to the specified queryable.
 22    /// </summary>
 23    /// <param name="queryable">The queryable.</param>
 24    /// <returns>The filtered queryable.</returns>
 25    public IQueryable<User> Apply(IQueryable<User> queryable)
 26    {
 027        var filter = this;
 028        if (filter.Id != null) queryable = queryable.Where(x => x.Id == filter.Id);
 029        if (filter.Name != null) queryable = queryable.Where(x => x.Name == filter.Name);
 30
 031        return queryable;
 32    }
 33}