< Summary

Information
Class: ArturRios.Extensions.ComparisonExtensions
Assembly: ArturRios.Extensions
File(s): D:\Repositories\dotnet-extensions\src\ComparisonExtensions.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 27
Line coverage: 100%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage
100%
Covered methods: 2
Fully covered methods: 2
Total methods: 2
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
In(...)50%44100%
NotIn(...)100%11100%

File(s)

D:\Repositories\dotnet-extensions\src\ComparisonExtensions.cs

#LineLine coverage
 1namespace ArturRios.Extensions;
 2
 3/// <summary>
 4///     Provides comparison helpers and syntactic sugar for checking membership (In/NotIn).
 5/// </summary>
 6public static class ComparisonExtensions
 7{
 8    /// <summary>
 9    ///     Provides comparison helpers for the given value.
 10    /// </summary>
 11    extension<T>(T self)
 12    {
 13        /// <summary>
 14        ///     Returns true if the value is equal to any element in the provided range.
 15        /// </summary>
 16        /// <param name="range">Values to compare against.</param>
 17        /// <returns>True if a match is found; otherwise false.</returns>
 2018        public bool In(params T[] range) => range.Any(t => t?.Equals(self) ?? self == null);
 19
 20        /// <summary>
 21        ///     Returns true if the value is not equal to any element in the provided range.
 22        /// </summary>
 23        /// <param name="range">Values to compare against.</param>
 24        /// <returns>True if no match is found; otherwise false.</returns>
 225        public bool NotIn(params T[] range) => !self.In(range);
 26    }
 27}

Methods/Properties

In(T,T[])
NotIn(T,T[])