< Summary

Information
Class: Elsa.Workflows.Runtime.Stores.MemoryBookmarkQueueStore
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Stores/MemoryBookmarkQueueStore.cs
Line coverage
64%
Covered lines: 11
Uncovered lines: 6
Coverable lines: 17
Total lines: 61
Line coverage: 64.7%
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%
SaveAsync(...)100%210%
AddAsync(...)100%11100%
FindAsync(...)100%210%
PageAsync(...)100%11100%
PageAsync(...)100%210%
FindManyAsync(...)100%11100%
DeleteAsync()100%11100%
Filter(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Stores/MemoryBookmarkQueueStore.cs

#LineLine coverage
 1using Elsa.Common.Models;
 2using Elsa.Common.Services;
 3using Elsa.Extensions;
 4using Elsa.Workflows.Runtime.Entities;
 5using Elsa.Workflows.Runtime.Filters;
 6using Elsa.Workflows.Runtime.OrderDefinitions;
 7using JetBrains.Annotations;
 8
 9namespace Elsa.Workflows.Runtime.Stores;
 10
 11/// <inheritdoc />
 12[UsedImplicitly]
 16013public class MemoryBookmarkQueueStore(MemoryStore<BookmarkQueueItem> store) : IBookmarkQueueStore
 14{
 15    /// <inheritdoc />
 16    public Task SaveAsync(BookmarkQueueItem record, CancellationToken cancellationToken = default)
 17    {
 018        store.Save(record, x => x.Id);
 019        return Task.CompletedTask;
 20    }
 21
 22    public Task AddAsync(BookmarkQueueItem record, CancellationToken cancellationToken = default)
 23    {
 3224        store.Add(record, x => x.Id);
 1625        return Task.CompletedTask;
 26    }
 27
 28    /// <inheritdoc />
 29    public Task<BookmarkQueueItem?> FindAsync(BookmarkQueueFilter filter, CancellationToken cancellationToken = default)
 30    {
 031        var entity = store.Query(query => Filter(query, filter)).FirstOrDefault();
 032        return Task.FromResult(entity);
 33    }
 34
 35    public Task<Page<BookmarkQueueItem>> PageAsync<TOrderBy>(PageArgs pageArgs, BookmarkQueueItemOrder<TOrderBy> orderBy
 36    {
 1237        var entities = store.Query(query => query.OrderBy(orderBy)).Paginate(pageArgs);
 638        return Task.FromResult(entities);
 39    }
 40
 41    public Task<Page<BookmarkQueueItem>> PageAsync<TOrderBy>(PageArgs pageArgs, BookmarkQueueFilter filter, BookmarkQueu
 42    {
 043        var entities = store.Query(query => Filter(query, filter).OrderBy(orderBy)).Paginate(pageArgs);
 044        return Task.FromResult(entities);
 45    }
 46
 47    public Task<IEnumerable<BookmarkQueueItem>> FindManyAsync(BookmarkQueueFilter filter, CancellationToken cancellation
 48    {
 649        var entities = store.Query(query => Filter(query, filter)).AsEnumerable();
 350        return Task.FromResult(entities);
 51    }
 52
 53    /// <inheritdoc />
 54    public async Task<long> DeleteAsync(BookmarkQueueFilter filter, CancellationToken cancellationToken = default)
 55    {
 656        var ids = (await FindManyAsync(filter, cancellationToken)).Select(x => x.Id);
 357        return store.DeleteMany(ids);
 358    }
 59
 360    private static IQueryable<BookmarkQueueItem> Filter(IQueryable<BookmarkQueueItem> query, BookmarkQueueFilter filter)
 61}