< Summary

Information
Class: Fluorite.Strainer.Models.Filtering.Operators.FilterOperator
Assembly: Fluorite.Strainer
File(s): /builds/fluorite/strainer/src/Strainer/Models/Filtering/Operators/FilterOperator.cs
Line coverage
90%
Covered lines: 10
Uncovered lines: 1
Coverable lines: 11
Total lines: 62
Line coverage: 90.9%
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%
get_ExpressionProvider()100%11100%
get_IsCaseInsensitive()100%11100%
get_IsStringBased()100%11100%
get_Name()100%11100%
get_Symbol()100%11100%
ToString()100%210%

File(s)

/builds/fluorite/strainer/src/Strainer/Models/Filtering/Operators/FilterOperator.cs

#LineLine coverage
 1using System.Diagnostics;
 2using System.Linq.Expressions;
 3
 4namespace Fluorite.Strainer.Models.Filtering.Operators;
 5
 6/// <summary>
 7/// Provides information about filtering operator.
 8/// </summary>
 9[DebuggerDisplay("\\{{" + nameof(Symbol) + ",nq} {" + nameof(Name) + ",nq}\\}")]
 10public class FilterOperator : IFilterOperator
 11{
 12    /// <summary>
 13    /// Initializes a new instance of the <see cref="FilterOperator"/> class.
 14    /// </summary>
 2615    public FilterOperator(string name, string symbol, Func<IFilterExpressionContext, Expression> expressionFunc)
 16    {
 2617        Name = Guard.Against.NullOrWhiteSpace(name);
 2618        Symbol = Guard.Against.NullOrWhiteSpace(symbol);
 2619        ExpressionProvider = Guard.Against.Null(expressionFunc);
 2620    }
 21
 22    /// <summary>
 23    /// Gets a func providing an <see cref="Expression"/>
 24    /// with filter operator applied when supplied a <see cref="IFilterExpressionContext"/>.
 25    /// </summary>
 48426    public Func<IFilterExpressionContext, Expression> ExpressionProvider { get; }
 27
 28    /// <summary>
 29    /// Gets or sets a value indicating whether current
 30    /// operator is case insensitive.
 31    /// </summary>
 2632    public bool IsCaseInsensitive { get; set; }
 33
 34    /// <summary>
 35    /// Gets or sets a value indicating whether associated
 36    /// <see cref="Expression"/> uses method
 37    /// based on a <see cref="string"/> instance like
 38    /// <see cref="string.Contains(string)"/> or <see cref="string.StartsWith(string)"/>.
 39    /// </summary>
 2640    public bool IsStringBased { get; set; }
 41
 42    /// <summary>
 43    /// Gets the operator name.
 44    /// </summary>
 345    public string Name { get; }
 46
 47    /// <summary>
 48    /// Gets a <see cref="string"/> representation of the operator.
 49    /// </summary>
 52450    public string Symbol { get; }
 51
 52    /// <summary>
 53    /// Returns a <see cref="string"/> that represents the current <see cref="FilterOperator"/>.
 54    /// </summary>
 55    /// <returns>
 56    /// A <see cref="string"/> that represents the current <see cref="FilterOperator"/>.
 57    /// </returns>
 58    public override string ToString()
 59    {
 060        return $"{Symbol} {Name}";
 61    }
 62}