< Summary

Information
Class: MyNet.Primitives.Intervals.NumericRange<T>
Assembly: MyNet.Primitives
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Primitives/Intervals/NumericRange.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 36
Line coverage: 100%
Branch coverage
75%
Covered branches: 6
Total branches: 8
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
MyNet.Primitives.Intervals.IBoundedInterval<T>.get_Start()100%11100%
MyNet.Primitives.Intervals.IBoundedInterval<T>.get_End()100%11100%
Create(...)75%88100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Primitives/Intervals/NumericRange.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="NumericRange.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Numerics;
 9
 10namespace MyNet.Primitives.Intervals;
 11
 12/// <summary>
 13/// Represents a closed numeric interval where both the start and end boundaries are defined and are inclusive. This cla
 14/// </summary>
 3915public sealed class NumericRange<T>(T start, T end) : NumericInterval<T, NumericRange<T>>(new IntervalBoundary<T>(start)
 16    where T : struct, INumber<T>, IMinMaxValue<T>
 17{
 18    /// <summary>
 19    /// Gets the start boundary of the interval, which is guaranteed to be inclusive. This property returns an <see cref
 20    /// </summary>
 621    IntervalBoundary<T> IBoundedInterval<T>.Start => Start!.Value;
 22
 23    /// <summary>
 24    /// Gets the end boundary of the interval, which is guaranteed to be inclusive. This property returns an <see cref="
 25    /// </summary>
 326    IntervalBoundary<T> IBoundedInterval<T>.End => End!.Value;
 27
 28    /// <inheritdoc />
 29    protected override NumericRange<T> Create(IntervalBoundary<T>? start, IntervalBoundary<T>? end) =>
 930        !start.HasValue || !end.HasValue
 931            ? throw new InvalidOperationException("NumericRange must be bounded.")
 932            : !start.Value.IsInclusive || !end.Value.IsInclusive
 933                ? throw new InvalidOperationException("NumericRange only supports inclusive boundaries.")
 934                : new(start.Value.Value, end.Value.Value);
 35}
 36