< Summary

Information
Class: MyNet.Primitives.Intervals.ClosedInterval<T>
Assembly: MyNet.Primitives
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Primitives/Intervals/ClosedInterval.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 37
Line coverage: 100%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
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(...)50%88100%

File(s)

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

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="ClosedInterval.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8
 9namespace MyNet.Primitives.Intervals;
 10
 11/// <summary>
 12/// Represents a closed interval where both the start and end boundaries are defined and are inclusive. This class exten
 13/// </summary>
 14/// <param name="start">The start boundary of the interval.</param>
 15/// <param name="end">The end boundary of the interval.</param>
 2716public class ClosedInterval<T>(T start, T end) : Interval<T, ClosedInterval<T>>(new IntervalBoundary<T>(start), new Inte
 17    where T : struct, IComparable<T>
 18{
 19    /// <summary>
 20    /// Gets the start boundary of the interval, which is guaranteed to be inclusive. This property returns an <see cref
 21    /// </summary>
 1522    IntervalBoundary<T> IBoundedInterval<T>.Start => Start!.Value;
 23
 24    /// <summary>
 25    /// Gets the end boundary of the interval, which is guaranteed to be inclusive. This property returns an <see cref="
 26    /// </summary>
 1527    IntervalBoundary<T> IBoundedInterval<T>.End => End!.Value;
 28
 29    /// <inheritdoc />
 30    protected override ClosedInterval<T> Create(IntervalBoundary<T>? start, IntervalBoundary<T>? end) =>
 331        !start.HasValue || !end.HasValue
 332            ? throw new InvalidOperationException("ClosedInterval must be bounded.")
 333            : !start.Value.IsInclusive || !end.Value.IsInclusive
 334                ? throw new InvalidOperationException("ClosedInterval only supports inclusive boundaries.")
 335                : new(start.Value.Value, end.Value.Value);
 36}
 37