< Summary

Information
Class: Pozitron.QuerySpecification.LikeExpression<T>
Assembly: Pozitron.QuerySpecification
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Expressions/LikeExpression.cs
Tag: 52_11740816328
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 77
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_KeySelector()100%11100%
get_Pattern()100%11100%
get_Group()100%11100%
.ctor(...)100%11100%

File(s)

/home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Expressions/LikeExpression.cs

#LineLine coverage
 1using System.Diagnostics;
 2
 3namespace Pozitron.QuerySpecification;
 4
 5/// <summary>
 6/// Represents a like expression used in a specification.
 7/// </summary>
 8/// <typeparam name="T">The type of the entity.</typeparam>
 9public sealed class LikeExpression<T>
 10{
 11    /// <summary>
 12    /// Gets the key selector expression.
 13    /// </summary>
 314    public Expression<Func<T, string?>> KeySelector { get; }
 15
 16    /// <summary>
 17    /// Gets the pattern to match.
 18    /// </summary>
 319    public string Pattern { get; }
 20
 21    /// <summary>
 22    /// Gets the group number.
 23    /// </summary>
 1124    public int Group { get; }
 25
 26    /// <summary>
 27    /// Initializes a new instance of the <see cref="LikeExpression{T}"/> class.
 28    /// </summary>
 29    /// <param name="keySelector">The key selector expression.</param>
 30    /// <param name="pattern">The pattern to match.</param>
 31    /// <param name="group">The group number.</param>
 3132    public LikeExpression(Expression<Func<T, string?>> keySelector, string pattern, int group = 1)
 33    {
 34        Debug.Assert(keySelector is not null);
 35        Debug.Assert(!string.IsNullOrEmpty(pattern));
 3136        KeySelector = keySelector;
 3137        Pattern = pattern;
 3138        Group = group;
 3139    }
 40}
 41
 42/// <summary>
 43/// Represents a compiled like expression used in a specification.
 44/// </summary>
 45/// <typeparam name="T">The type of the entity.</typeparam>
 46public sealed class LikeExpressionCompiled<T>
 47{
 48    /// <summary>
 49    /// Gets the compiled key selector function.
 50    /// </summary>
 51    public Func<T, string?> KeySelector { get; }
 52
 53    /// <summary>
 54    /// Gets the pattern to match.
 55    /// </summary>
 56    public string Pattern { get; }
 57
 58    /// <summary>
 59    /// Gets the group number.
 60    /// </summary>
 61    public int Group { get; }
 62
 63    /// <summary>
 64    /// Initializes a new instance of the <see cref="LikeExpressionCompiled{T}"/> class.
 65    /// </summary>
 66    /// <param name="keySelector">The compiled key selector function.</param>
 67    /// <param name="pattern">The pattern to match.</param>
 68    /// <param name="group">The group number.</param>
 69    public LikeExpressionCompiled(Func<T, string?> keySelector, string pattern, int group = 1)
 70    {
 71        Debug.Assert(keySelector is not null);
 72        Debug.Assert(!string.IsNullOrEmpty(pattern));
 73        KeySelector = keySelector;
 74        Pattern = pattern;
 75        Group = group;
 76    }
 77}