< Summary

Information
Class: TeleFlow.Annotations.CallbackDataPrefixAttribute
Assembly: TeleFlow.Annotations
File(s): /_/src/TeleFlow.Annotations/Callbacks/CallbackDataPrefixAttribute.cs
Line coverage
80%
Covered lines: 4
Uncovered lines: 1
Coverable lines: 5
Total lines: 26
Line coverage: 80%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)50%2280%

File(s)

/_/src/TeleFlow.Annotations/Callbacks/CallbackDataPrefixAttribute.cs

#LineLine coverage
 1namespace TeleFlow.Annotations;
 2/// <summary>
 3/// Restricts callback query routing to callback data with the specified prefix.
 4/// </summary>
 5[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
 6public sealed class CallbackDataPrefixAttribute : TeleFlowAttribute
 7{
 8    /// <summary>
 9    /// Creates a callback data prefix filter.
 10    /// </summary>
 11    /// <param name="prefix">Callback data prefix to match.</param>
 3412    public CallbackDataPrefixAttribute(string prefix)
 13    {
 3414        if (string.IsNullOrWhiteSpace(prefix))
 15        {
 016            throw new ArgumentException("Callback data prefix must not be empty.", nameof(prefix));
 17        }
 18
 3419        Prefix = prefix.Trim();
 3420    }
 21
 22    /// <summary>
 23    /// Callback data prefix that must be present on the incoming callback query.
 24    /// </summary>
 25    public string Prefix { get; }
 26}

Methods/Properties

.ctor(System.String)