< Summary

Information
Class: TeleFlow.Telegram.TelegramPolledUpdate
Assembly: TeleFlow.Telegram.LongPolling
File(s): /_/src/TeleFlow.Telegram.LongPolling/TelegramPolledUpdate.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 35
Line coverage: 100%
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%
get_IsAcknowledged()100%11100%
AcknowledgeAsync(...)100%11100%

File(s)

/_/src/TeleFlow.Telegram.LongPolling/TelegramPolledUpdate.cs

#LineLine coverage
 1using TeleFlow.Telegram.Schema.Types;
 2
 3namespace TeleFlow.Telegram;
 4
 5public sealed class TelegramPolledUpdate
 6{
 7    private int _acknowledged;
 8
 9    internal TelegramPolledUpdate(
 10        Update update,
 11        int batchIndex = 1,
 12        int batchCount = 1)
 13    {
 2214        ArgumentNullException.ThrowIfNull(update);
 15
 16        Update = update;
 17        BatchIndex = batchIndex;
 18        BatchCount = batchCount;
 2219    }
 20
 21    public Update Update { get; }
 22
 23    internal int BatchIndex { get; }
 24
 25    internal int BatchCount { get; }
 26
 1927    internal bool IsAcknowledged => Volatile.Read(ref _acknowledged) != 0;
 28
 29    public ValueTask AcknowledgeAsync(CancellationToken cancellationToken = default)
 30    {
 1831        cancellationToken.ThrowIfCancellationRequested();
 1832        Interlocked.Exchange(ref _acknowledged, 1);
 1833        return ValueTask.CompletedTask;
 34    }
 35}