< Summary

Information
Class: Pozitron.QuerySpecification.OrderedBuilderExtensions
Assembly: Pozitron.QuerySpecification
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Builders/OrderedBuilderExtensions.cs
Tag: 50_11685979511
Line coverage
100%
Covered lines: 20
Uncovered lines: 0
Coverable lines: 20
Total lines: 92
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 && !Specification<T, TResult>.IsChainDiscarded)
 16        {
 517            orderedBuilder.Specification.AddInternal(ItemType.Order, orderExpression, (int)OrderType.ThenBy);
 18        }
 19        else
 20        {
 421            Specification<T, TResult>.IsChainDiscarded = true;
 22        }
 23
 924        return orderedBuilder;
 25    }
 26
 27    public static IOrderedSpecificationBuilder<T> ThenBy<T>(
 28        this IOrderedSpecificationBuilder<T> orderedBuilder,
 29        Expression<Func<T, object?>> orderExpression)
 1330        => ThenBy(orderedBuilder, orderExpression, true);
 31
 32    public static IOrderedSpecificationBuilder<T> ThenBy<T>(
 33        this IOrderedSpecificationBuilder<T> orderedBuilder,
 34        Expression<Func<T, object?>> orderExpression,
 35        bool condition)
 36    {
 1537        if (condition && !Specification<T>.IsChainDiscarded)
 38        {
 1139            orderedBuilder.Specification.AddInternal(ItemType.Order, orderExpression, (int)OrderType.ThenBy);
 40        }
 41        else
 42        {
 443            Specification<T>.IsChainDiscarded = true;
 44        }
 45
 1546        return orderedBuilder;
 47    }
 48
 49    public static IOrderedSpecificationBuilder<T, TResult> ThenByDescending<T, TResult>(
 50        this IOrderedSpecificationBuilder<T, TResult> orderedBuilder,
 51        Expression<Func<T, object?>> orderExpression)
 1152        => ThenByDescending(orderedBuilder, orderExpression, true);
 53
 54    public static IOrderedSpecificationBuilder<T, TResult> ThenByDescending<T, TResult>(
 55        this IOrderedSpecificationBuilder<T, TResult> orderedBuilder,
 56        Expression<Func<T, object?>> orderExpression,
 57        bool condition)
 58    {
 1359        if (condition && !Specification<T, TResult>.IsChainDiscarded)
 60        {
 961            orderedBuilder.Specification.AddInternal(ItemType.Order, orderExpression, (int)OrderType.ThenByDescending);
 62        }
 63        else
 64        {
 465            Specification<T, TResult>.IsChainDiscarded = true;
 66        }
 67
 1368        return orderedBuilder;
 69    }
 70
 71    public static IOrderedSpecificationBuilder<T> ThenByDescending<T>(
 72        this IOrderedSpecificationBuilder<T> orderedBuilder,
 73        Expression<Func<T, object?>> orderExpression)
 1374        => ThenByDescending(orderedBuilder, orderExpression, true);
 75
 76    public static IOrderedSpecificationBuilder<T> ThenByDescending<T>(
 77        this IOrderedSpecificationBuilder<T> orderedBuilder,
 78        Expression<Func<T, object?>> orderExpression,
 79        bool condition)
 80    {
 1581        if (condition && !Specification<T>.IsChainDiscarded)
 82        {
 1183            orderedBuilder.Specification.AddInternal(ItemType.Order, orderExpression, (int)OrderType.ThenByDescending);
 84        }
 85        else
 86        {
 487            Specification<T>.IsChainDiscarded = true;
 88        }
 89
 1590        return orderedBuilder;
 91    }
 92}