< Summary

Information
Class: Elsa.Workflows.Runtime.Stores.MemoryBookmarkStore
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Stores/MemoryBookmarkStore.cs
Line coverage
69%
Covered lines: 9
Uncovered lines: 4
Coverable lines: 13
Total lines: 48
Line coverage: 69.2%
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%11100%
SaveManyAsync(...)100%210%
FindAsync(...)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/MemoryBookmarkStore.cs

#LineLine coverage
 1using Elsa.Common.Services;
 2using Elsa.Workflows.Runtime.Entities;
 3using Elsa.Workflows.Runtime.Filters;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Workflows.Runtime.Stores;
 7
 8/// <inheritdoc />
 9[UsedImplicitly]
 15810public class MemoryBookmarkStore(MemoryStore<StoredBookmark> store) : IBookmarkStore
 11{
 12    /// <inheritdoc />
 13    public ValueTask SaveAsync(StoredBookmark record, CancellationToken cancellationToken = default)
 14    {
 4215        store.Save(record, x => x.Id);
 2116        return ValueTask.CompletedTask;
 17    }
 18
 19    /// <inheritdoc />
 20    public ValueTask SaveManyAsync(IEnumerable<StoredBookmark> records, CancellationToken cancellationToken)
 21    {
 022        store.SaveMany(records, x => x.Id);
 023        return ValueTask.CompletedTask;
 24    }
 25
 26    /// <inheritdoc />
 27    public ValueTask<StoredBookmark?> FindAsync(BookmarkFilter filter, CancellationToken cancellationToken = default)
 28    {
 029        var entity = store.Query(query => Filter(query, filter)).FirstOrDefault();
 030        return new(entity);
 31    }
 32
 33    /// <inheritdoc />
 34    public ValueTask<IEnumerable<StoredBookmark>> FindManyAsync(BookmarkFilter filter, CancellationToken cancellationTok
 35    {
 10036        var entities = store.Query(query => Filter(query, filter)).AsEnumerable();
 5037        return new(entities);
 38    }
 39
 40    /// <inheritdoc />
 41    public async ValueTask<long> DeleteAsync(BookmarkFilter filter, CancellationToken cancellationToken = default)
 42    {
 3243        var ids = (await FindManyAsync(filter, cancellationToken)).Select(x => x.Id);
 1444        return store.DeleteMany(ids);
 1445    }
 46
 5047    private static IQueryable<StoredBookmark> Filter(IQueryable<StoredBookmark> query, BookmarkFilter filter) => filter.
 48}