< Summary

Information
Class: TeleFlow.Telegram.Internal.TelegramUpdateDecodeResult
Assembly: TeleFlow.Telegram.Client
File(s): /_/src/TeleFlow.Telegram.Client/Internal/TelegramUpdateDecodeResult.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 34
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
get_IsSuccess()100%11100%
Success(...)100%11100%
Failure(...)100%11100%

File(s)

/_/src/TeleFlow.Telegram.Client/Internal/TelegramUpdateDecodeResult.cs

#LineLine coverage
 1using TeleFlow.Telegram.Schema.Types;
 2
 3namespace TeleFlow.Telegram.Internal;
 4
 5/// <summary>
 6/// Carries either a decoded Telegram update or the evidence required to apply an explicit poison-update policy.
 7/// </summary>
 8internal readonly record struct TelegramUpdateDecodeResult(
 9    long UpdateId,
 10    Update? Update,
 11    string? RawPayloadJson,
 12    string? PayloadSha256,
 13    TelegramUpdateDecodeException? Exception)
 14{
 5015    public bool IsSuccess => Update is not null;
 16
 17    public static TelegramUpdateDecodeResult Success(Update update)
 18    {
 4319        ArgumentNullException.ThrowIfNull(update);
 4320        return new TelegramUpdateDecodeResult(update.UpdateId, update, null, null, null);
 21    }
 22
 23    public static TelegramUpdateDecodeResult Failure(
 24        long updateId,
 25        string rawPayloadJson,
 26        string payloadSha256,
 27        TelegramUpdateDecodeException exception)
 28    {
 829        ArgumentException.ThrowIfNullOrWhiteSpace(rawPayloadJson);
 830        ArgumentException.ThrowIfNullOrWhiteSpace(payloadSha256);
 831        ArgumentNullException.ThrowIfNull(exception);
 832        return new TelegramUpdateDecodeResult(updateId, null, rawPayloadJson, payloadSha256, exception);
 33    }
 34}