< Summary

Information
Class: TeleFlow.Annotations.TextAttribute
Assembly: TeleFlow.Annotations
File(s): /_/src/TeleFlow.Annotations/Routing/TextAttribute.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 39
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%

File(s)

/_/src/TeleFlow.Annotations/Routing/TextAttribute.cs

#LineLine coverage
 1namespace TeleFlow.Annotations;
 2/// <summary>
 3/// Routes a Telegram text message by comparing it with a configured text value.
 4/// </summary>
 5[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
 6public sealed class TextAttribute : TeleFlowAttribute
 7{
 8    /// <summary>
 9    /// Creates a text route.
 10    /// </summary>
 11    /// <param name="value">Text value to match.</param>
 12    /// <param name="mode">Text comparison mode.</param>
 13    /// <param name="ignoreCase">Whether text comparison ignores case.</param>
 5614    public TextAttribute(
 5615        string value,
 5616        TextMatchMode mode = TextMatchMode.Equals,
 5617        bool ignoreCase = true)
 18    {
 5619        ArgumentException.ThrowIfNullOrWhiteSpace(value);
 20        Value = value;
 21        Mode = mode;
 22        IgnoreCase = ignoreCase;
 5623    }
 24
 25    /// <summary>
 26    /// Text value used for route matching.
 27    /// </summary>
 28    public string Value { get; }
 29
 30    /// <summary>
 31    /// Text comparison mode.
 32    /// </summary>
 33    public TextMatchMode Mode { get; }
 34
 35    /// <summary>
 36    /// Indicates whether text comparison ignores case.
 37    /// </summary>
 38    public bool IgnoreCase { get; }
 39}