< Summary

Information
Class: Elsa.Workflows.Runtime.Filters.BookmarkQueueFilter
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Filters/BookmarkQueueFilter.cs
Line coverage
94%
Covered lines: 18
Uncovered lines: 1
Coverable lines: 19
Total lines: 72
Line coverage: 94.7%
Branch coverage
56%
Covered branches: 9
Total branches: 16
Branch coverage: 56.2%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_Ids()100%11100%
get_BookmarkId()100%11100%
get_WorkflowInstanceId()100%11100%
get_BookmarkHash()100%11100%
get_ActivityInstanceId()100%11100%
get_ActivityTypeName()100%11100%
get_CreatedAtLessThan()100%11100%
get_TenantAgnostic()100%210%
Apply(...)56.25%1616100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Filters/BookmarkQueueFilter.cs

#LineLine coverage
 1using Elsa.Workflows.Runtime.Entities;
 2
 3namespace Elsa.Workflows.Runtime.Filters;
 4
 5/// <summary>
 6/// A filter for bookmark queue items.
 7/// </summary>
 8public class BookmarkQueueFilter
 9{
 10    /// <summary>
 11    /// Gets or sets the ID of the bookmark queue item.
 12    /// </summary>
 5513    public string? Id { get; set; }
 14
 15    /// <summary>
 16    /// Gets or sets the IDs of the bookmark queue items.
 17    /// </summary>
 1818    public IEnumerable<string>? Ids { get; set; }
 19
 20    /// <summary>
 21    /// Gets or sets the ID of the bookmark.
 22    /// </summary>
 1823    public string? BookmarkId { get; set; }
 24
 25    /// <summary>
 26    /// Gets or sets the IDs of the workflow instance.
 27    /// </summary>
 1828    public string? WorkflowInstanceId { get; set; }
 29
 30    /// <summary>
 31    /// Gets or sets the bookmark hash of the bookmark queue item to find.
 32    /// </summary>
 1833    public string? BookmarkHash { get; set; }
 34
 35    /// <summary>
 36    /// The ID of the activity instance associated with the bookmark.
 37    /// </summary>
 1838    public string? ActivityInstanceId { get; set; }
 39
 40    /// <summary>
 41    /// The type name of the activity associated with the bookmark.
 42    /// </summary>
 1843    public string? ActivityTypeName { get; set; }
 44
 45    /// <summary>
 46    /// The timestamp less than which the bookmark queue item was created.
 47    /// </summary>
 1848    public DateTimeOffset? CreatedAtLessThan { get; set; }
 49
 50    /// <summary>
 51    /// Gets or sets a value indicating whether the filter is tenant agnostic.
 52    /// </summary>
 053    public bool TenantAgnostic { get; set; }
 54
 55    /// <summary>
 56    /// Applies the filter to the specified query.
 57    /// </summary>
 58    public IQueryable<BookmarkQueueItem> Apply(IQueryable<BookmarkQueueItem> query)
 59    {
 1860        var filter = this;
 3661        if (filter.Id != null) query = query.Where(x => x.Id == filter.Id);
 1862        if (filter.Ids != null) query = query.Where(x => filter.Ids.Contains(x.Id));
 1863        if (filter.BookmarkId != null) query = query.Where(x => x.BookmarkId == filter.BookmarkId);
 1864        if (filter.BookmarkHash != null) query = query.Where(x => x.StimulusHash == filter.BookmarkHash);
 1865        if (filter.ActivityInstanceId != null) query = query.Where(x => x.ActivityInstanceId == filter.ActivityInstanceI
 1866        if (filter.ActivityTypeName != null) query = query.Where(x => x.ActivityTypeName == filter.ActivityTypeName);
 1867        if (filter.WorkflowInstanceId != null) query = query.Where(x => x.WorkflowInstanceId == filter.WorkflowInstanceI
 1868        if (filter.CreatedAtLessThan != null) query = query.Where(x => x.CreatedAt < filter.CreatedAtLessThan);
 69
 1870        return query;
 71    }
 72}