< Summary

Information
Class: Services.EmailRoutingServices.InboxKnownMessages
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/EmailRoutingServices/InboxKnownMessages.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 33
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
get_ExternalIds()100%11100%
get_Uids()100%11100%
IsKnown(...)100%66100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/EmailRoutingServices/InboxKnownMessages.cs

#LineLine coverage
 1using MailKit;
 2
 3namespace Services.EmailRoutingServices;
 4
 5/// <summary>
 6/// Кэш уже обработанных писем для пропуска повторной загрузки с IMAP.
 7/// </summary>
 8public sealed class InboxKnownMessages
 9{
 110    private static readonly HashSet<string> Empty = new(StringComparer.Ordinal);
 11
 3512    public IReadOnlySet<string> ExternalIds { get; init; } = Empty;
 13
 2914    public IReadOnlySet<string> Uids { get; init; } = Empty;
 15
 16    public bool IsKnown(UniqueId uid, string? messageId)
 17    {
 518        if (Uids.Contains(uid.Id.ToString()))
 19        {
 120            return true;
 21        }
 22
 2423        foreach (var key in ImapEmailInboxClient.GetExternalIdLookupKeys(uid, messageId))
 24        {
 925            if (ExternalIds.Contains(key))
 26            {
 227                return true;
 28            }
 29        }
 30
 231        return false;
 232    }
 33}