< Summary

Information
Class: Pozitron.QuerySpecification.LikeValidator
Assembly: Pozitron.QuerySpecification
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Validators/LikeValidator.cs
Tag: 44_11195777782
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 17
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
.cctor()100%11100%
IsValid(...)100%1010100%

File(s)

/home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Validators/LikeValidator.cs

#LineLine coverage
 1namespace Pozitron.QuerySpecification;
 2
 3public class LikeValidator : IValidator
 4{
 25    private LikeValidator() { }
 16    public static LikeValidator Instance = new();
 7
 8    public bool IsValid<T>(T entity, Specification<T> specification)
 9    {
 6810        foreach (var likeGroup in specification.LikeExpressions.GroupBy(x => x.Group))
 11        {
 3512            if (likeGroup.Any(c => c.KeySelectorFunc(entity)?.Like(c.Pattern) ?? false) == false) return false;
 13        }
 14
 815        return true;
 416    }
 17}