< Summary

Information
Class: Fluorite.Strainer.Models.Sorting.CustomSortMethod<T>
Assembly: Fluorite.Strainer
File(s): /builds/fluorite/strainer/src/Strainer/Models/Sorting/CustomSortMethod{T}.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 51
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
.ctor(...)100%11100%
.ctor(...)100%11100%
get_Expression()100%11100%
get_ExpressionProvider()100%11100%

File(s)

/builds/fluorite/strainer/src/Strainer/Models/Sorting/CustomSortMethod{T}.cs

#LineLine coverage
 1using Fluorite.Strainer.Models.Sorting.Terms;
 2using System.Linq.Expressions;
 3
 4namespace Fluorite.Strainer.Models.Sorting;
 5
 6/// <summary>
 7/// Represents custom sort method.
 8/// </summary>
 9/// <typeparam name="T">
 10/// The type of entity processed by the custom method.
 11/// </typeparam>
 12public class CustomSortMethod<T> : CustomSortMethod, ICustomSortMethod<T>
 13{
 14    /// <summary>
 15    /// Initializes a new instance of the <see cref="CustomSortMethod{T}"/> class.
 16    /// </summary>
 17    /// <param name="name">
 18    /// The custom sort method name.
 19    /// </param>
 20    /// <param name="expression">
 21    /// The expression used for custom sorting.
 22    /// </param>
 423    public CustomSortMethod(string name, Expression<Func<T, object>> expression) : base(name)
 24    {
 425        Expression = Guard.Against.Null(expression);
 426    }
 27
 28    /// <summary>
 29    /// Initializes a new instance of the <see cref="CustomSortMethod{T}"/> class.
 30    /// </summary>
 31    /// <param name="name">
 32    /// The custom sort method name.
 33    /// </param>
 34    /// <param name="expressionProvider">
 35    /// The expression used for custom sorting.
 36    /// </param>
 137    public CustomSortMethod(string name, Func<ISortTerm, Expression<Func<T, object>>> expressionProvider) : base(name)
 38    {
 139        ExpressionProvider = Guard.Against.Null(expressionProvider);
 140    }
 41
 42    /// <summary>
 43    /// Gets the expression used for custom sorting.
 44    /// </summary>
 545    public Expression<Func<T, object>>? Expression { get; }
 46
 47    /// <summary>
 48    /// Gets the provider of expression used for custom sorting.
 49    /// </summary>
 450    public Func<ISortTerm, Expression<Func<T, object>>>? ExpressionProvider { get; }
 51}