< Summary

Information
Class: Pozitron.QuerySpecification.OrderedBuilderExtensions
Assembly: Pozitron.QuerySpecification
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Builders/OrderedBuilderExtensions.cs
Tag: 44_11195777782
Line coverage
100%
Covered lines: 24
Uncovered lines: 0
Coverable lines: 24
Total lines: 96
Line coverage: 100%
Branch coverage
100%
Covered branches: 16
Total branches: 16
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ThenBy(...)100%11100%
ThenBy(...)100%44100%
ThenBy(...)100%11100%
ThenBy(...)100%44100%
ThenByDescending(...)100%11100%
ThenByDescending(...)100%44100%
ThenByDescending(...)100%11100%
ThenByDescending(...)100%44100%

File(s)

/home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Builders/OrderedBuilderExtensions.cs

#LineLine coverage
 1namespace Pozitron.QuerySpecification;
 2
 3public static class OrderedBuilderExtensions
 4{
 5    public static IOrderedSpecificationBuilder<T, TResult> ThenBy<T, TResult>(
 6        this IOrderedSpecificationBuilder<T, TResult> orderedBuilder,
 7        Expression<Func<T, object?>> orderExpression)
 78        => ThenBy(orderedBuilder, orderExpression, true);
 9
 10    public static IOrderedSpecificationBuilder<T, TResult> ThenBy<T, TResult>(
 11        this IOrderedSpecificationBuilder<T, TResult> orderedBuilder,
 12        Expression<Func<T, object?>> orderExpression,
 13        bool condition)
 14    {
 915        if (condition && !orderedBuilder.IsChainDiscarded)
 16        {
 517            var expr = new OrderExpression<T>(orderExpression, OrderTypeEnum.ThenBy);
 518            orderedBuilder.Specification.Add(expr);
 19        }
 20        else
 21        {
 422            orderedBuilder.IsChainDiscarded = true;
 23        }
 24
 925        return orderedBuilder;
 26    }
 27
 28    public static IOrderedSpecificationBuilder<T> ThenBy<T>(
 29        this IOrderedSpecificationBuilder<T> orderedBuilder,
 30        Expression<Func<T, object?>> orderExpression)
 931        => ThenBy(orderedBuilder, orderExpression, true);
 32
 33    public static IOrderedSpecificationBuilder<T> ThenBy<T>(
 34        this IOrderedSpecificationBuilder<T> orderedBuilder,
 35        Expression<Func<T, object?>> orderExpression,
 36        bool condition)
 37    {
 1138        if (condition && !orderedBuilder.IsChainDiscarded)
 39        {
 740            var expr = new OrderExpression<T>(orderExpression, OrderTypeEnum.ThenBy);
 741            orderedBuilder.Specification.Add(expr);
 42        }
 43        else
 44        {
 445            orderedBuilder.IsChainDiscarded = true;
 46        }
 47
 1148        return orderedBuilder;
 49    }
 50
 51    public static IOrderedSpecificationBuilder<T, TResult> ThenByDescending<T, TResult>(
 52        this IOrderedSpecificationBuilder<T, TResult> orderedBuilder,
 53        Expression<Func<T, object?>> orderExpression)
 1154        => ThenByDescending(orderedBuilder, orderExpression, true);
 55
 56    public static IOrderedSpecificationBuilder<T, TResult> ThenByDescending<T, TResult>(
 57        this IOrderedSpecificationBuilder<T, TResult> orderedBuilder,
 58        Expression<Func<T, object?>> orderExpression,
 59        bool condition)
 60    {
 1361        if (condition && !orderedBuilder.IsChainDiscarded)
 62        {
 963            var expr = new OrderExpression<T>(orderExpression, OrderTypeEnum.ThenByDescending);
 964            orderedBuilder.Specification.Add(expr);
 65        }
 66        else
 67        {
 468            orderedBuilder.IsChainDiscarded = true;
 69        }
 70
 1371        return orderedBuilder;
 72    }
 73
 74    public static IOrderedSpecificationBuilder<T> ThenByDescending<T>(
 75        this IOrderedSpecificationBuilder<T> orderedBuilder,
 76        Expression<Func<T, object?>> orderExpression)
 1377        => ThenByDescending(orderedBuilder, orderExpression, true);
 78
 79    public static IOrderedSpecificationBuilder<T> ThenByDescending<T>(
 80        this IOrderedSpecificationBuilder<T> orderedBuilder,
 81        Expression<Func<T, object?>> orderExpression,
 82        bool condition)
 83    {
 1584        if (condition && !orderedBuilder.IsChainDiscarded)
 85        {
 1186            var expr = new OrderExpression<T>(orderExpression, OrderTypeEnum.ThenByDescending);
 1187            orderedBuilder.Specification.Add(expr);
 88        }
 89        else
 90        {
 491            orderedBuilder.IsChainDiscarded = true;
 92        }
 93
 1594        return orderedBuilder;
 95    }
 96}