internal static Anomaly Validate <TValue>(this IDetectionRange <TValue> range, TValue value)
            where TValue : IComparable <TValue>
        {
            if (CompareUtilities.GreaterThan(value, range.MaxDetectionHigh))
            {
                return(Anomaly.High);
            }

            if (CompareUtilities.SmallerThan(value, range.MaxDetectionLow))
            {
                return(Anomaly.Low);
            }

            return(Anomaly.None);
        }
Ejemplo n.º 2
0
 public void GreaterThan_When_Double(int value, int compare, bool expected)
 {
     Assert.Equal(expected, CompareUtilities.GreaterThan(RangeFactory.ToTestDouble(value), RangeFactory.ToTestDouble(compare)));
 }
Ejemplo n.º 3
0
 public void GreaterThan_When_Int(int value, int compare, bool expected)
 {
     Assert.Equal(expected, CompareUtilities.GreaterThan(value, compare));
 }
 /// <summary>
 /// Do the ranges overlap.
 /// Is <see cref="range.From"/> smaller than <see cref="compare.Till"/>
 /// And <see cref="range.Till"/> greater than <see cref="compare.From"/>
 /// </summary>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="range"></param>
 /// <param name="compare"></param>
 /// <returns></returns>
 public static bool OverLaps <TValue>(this IRange <TValue> range, IRange <TValue> compare)
     where TValue : IComparable <TValue>
 {
     return(CompareUtilities.SmallerThan(range.From, compare.Till) && CompareUtilities.GreaterThan(range.Till, compare.From));
 }
 /// <summary>
 /// Is <see cref="value"/> greater than <see cref="IRange{TValue}.From"/> and smaller than <see cref="IRange{TValue}.Till"/>
 /// </summary>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="range"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public static bool InBetween <TValue>(this IRange <TValue> range, TValue value)
     where TValue : IComparable <TValue>
 {
     return(CompareUtilities.SmallerThan(range.From, value) && CompareUtilities.GreaterThan(range.Till, value));
 }
 /// <summary>
 /// Does the <see cref="range"/> equal or exceed the limits of <see cref="compare.From"/>
 /// Is <see cref="range.From"/> smaller or equal to <see cref="compare.From"/>
 /// Is <see cref="range.Till"/> greater than <see cref="compare.From"/>
 /// </summary>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="range"></param>
 /// <param name="compare"></param>
 /// <returns></returns>
 public static bool EcapsulatesFrom <TValue>(this IRange <TValue> range, IRange <TValue> compare)
     where TValue : IComparable <TValue>
 {
     return(CompareUtilities.SmallerOrEqualTo(range.From, compare.From) && CompareUtilities.GreaterThan(range.Till, compare.From));
 }