< Summary

Information
Class: Pozitron.QuerySpecification.IncludeStringEvaluator
Assembly: Pozitron.QuerySpecification.EntityFrameworkCore
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification.EntityFrameworkCore/Evaluators/IncludeStringEvaluator.cs
Tag: 52_11740816328
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 28
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
.ctor()100%11100%
Evaluate(...)100%66100%

File(s)

/home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification.EntityFrameworkCore/Evaluators/IncludeStringEvaluator.cs

#LineLine coverage
 1namespace Pozitron.QuerySpecification;
 2
 3/// <summary>
 4/// Evaluates a specification to include navigation properties specified by string paths.
 5/// </summary>
 6public sealed class IncludeStringEvaluator : IEvaluator
 7{
 8
 9    /// <summary>
 10    /// Gets the singleton instance of the <see cref="IncludeStringEvaluator"/> class.
 11    /// </summary>
 112    public static IncludeStringEvaluator Instance = new();
 213    private IncludeStringEvaluator() { }
 14
 15    /// <inheritdoc/>
 16    public IQueryable<T> Evaluate<T>(IQueryable<T> source, Specification<T> specification) where T : class
 17    {
 55218        foreach (var item in specification.Items)
 19        {
 22420            if (item.Type == ItemType.IncludeString && item.Reference is string includeString)
 21            {
 1122                source = source.Include(includeString);
 23            }
 24        }
 25
 5226        return source;
 27    }
 28}