< Summary

Information
Class: Elsa.Workflows.Runtime.DefaultBookmarkManager
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/DefaultBookmarkManager.cs
Line coverage
71%
Covered lines: 10
Uncovered lines: 4
Coverable lines: 14
Total lines: 39
Line coverage: 71.4%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
DeleteManyAsync()100%44100%
SaveAsync()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/DefaultBookmarkManager.cs

#LineLine coverage
 1using Elsa.Mediator.Contracts;
 2using Elsa.Workflows.Runtime.Entities;
 3using Elsa.Workflows.Runtime.Filters;
 4using Elsa.Workflows.Runtime.Notifications;
 5using Microsoft.Extensions.Logging;
 6
 7namespace Elsa.Workflows.Runtime;
 8
 9/// <summary>
 10/// Default implementation of <see cref="IBookmarkManager"/>.
 11/// </summary>
 47112public class DefaultBookmarkManager(IBookmarkStore bookmarkStore, INotificationSender notificationSender, ILogger<Defaul
 13    : IBookmarkManager
 14{
 15    /// <inheritdoc />
 16    public async Task<long> DeleteManyAsync(BookmarkFilter filter, CancellationToken cancellationToken = default)
 17    {
 5518        var bookmarks = (await bookmarkStore.FindManyAsync(filter, cancellationToken)).ToList();
 5519        await notificationSender.SendAsync(new BookmarksDeleting(bookmarks), cancellationToken);
 5520        var count = await bookmarkStore.DeleteAsync(filter, cancellationToken);
 5521        await notificationSender.SendAsync(new BookmarksDeleted(bookmarks), cancellationToken);
 22
 5523        if (logger.IsEnabled(LogLevel.Debug))
 24        {
 5225            foreach (var bookmark in bookmarks)
 1526                logger.LogDebug("Deleted bookmark {BookmarkId} for workflow {WorkflowInstanceId}", bookmark.Id, bookmark
 27        }
 28
 5529        return count;
 5530    }
 31
 32    /// <inheritdoc />
 33    public async Task SaveAsync(StoredBookmark bookmark, CancellationToken cancellationToken = default)
 34    {
 035        await notificationSender.SendAsync(new BookmarkSaving(bookmark), cancellationToken);
 036        await bookmarkStore.SaveAsync(bookmark, cancellationToken);
 037        await notificationSender.SendAsync(new BookmarkSaved(bookmark), cancellationToken);
 038    }
 39}