< Summary

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

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="OpenInterval.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 an open interval where both the start and end boundaries are defined and are exclusive. This class extend
 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 OpenInterval<T>(T start, T end) : Interval<T, OpenInterval<T>>(new IntervalBoundary<T>(start, false), new I
 17    where T : struct, IComparable<T>
 18{
 19    /// <summary>
 20    /// Gets the start boundary of the interval, which is guaranteed to be exclusive. This property returns an <see cref
 21    /// </summary>
 322    IntervalBoundary<T> IBoundedInterval<T>.Start => Start!.Value;
 23
 24    /// <summary>
 25    /// Gets the end boundary of the interval, which is guaranteed to be exclusive. This property returns an <see cref="
 26    /// </summary>
 627    IntervalBoundary<T> IBoundedInterval<T>.End => End!.Value;
 28
 29    /// <inheritdoc />
 30    protected override OpenInterval<T> Create(IntervalBoundary<T>? start, IntervalBoundary<T>? end) =>
 931        !start.HasValue || !end.HasValue
 932            ? throw new InvalidOperationException("OpenInterval must be bounded.")
 933            : start.Value.IsInclusive || end.Value.IsInclusive
 934                ? throw new InvalidOperationException("OpenInterval only supports exclusive boundaries.")
 935                : new(start.Value.Value, end.Value.Value);
 36}
 37