github
2049 of 3728 branches covered (54.96%)
Branch coverage included in aggregate %.
5 of 33 new or added lines in 2 files covered. (15.15%)
1990 existing lines in 246 files now uncovered.8494 of 12829 relevant lines covered (66.21%)
100032.71 hits per line
1 |
using System; |
|
2 |
|
|
3 |
namespace Zilon.Core.Common
|
|
4 |
{ |
|
5 |
public static class RangeExtensions |
|
6 |
{ |
|
7 |
public static T GetBounded<T>(this Range<T> range, T value) where T : IComparable |
|
8 |
{ |
38,892✔ |
9 |
if (range is null)
|
|
UNCOV
10
|
{ |
× |
11 |
throw new ArgumentNullException(nameof(range)); |
× |
12 |
} |
|
13 |
|
|
14 |
var cMin = value.CompareTo(range.Min); |
38,892✔ |
15 |
if (cMin <= -1) |
|
16 |
{ |
26,603✔ |
17 |
return range.Min;
|
26,603✔ |
18 |
} |
|
19 |
|
|
20 |
var cMax = value.CompareTo(range.Max); |
12,289✔ |
21 |
if (cMax >= 1) |
|
22 |
{ |
8✔ |
23 |
return range.Max;
|
8✔ |
24 |
} |
|
25 |
|
|
26 |
return value;
|
12,281✔ |
27 |
} |
38,892✔ |
28 |
} |
|
29 |
} |