public void BoundedExclusiveIntervalEndpoint() { var boundedExclusive = new IntervalEndpoint <int>(7, false); Assert.IsTrue(boundedExclusive.Bounded); Assert.IsFalse(boundedExclusive.Inclusive); Assert.AreEqual(7, boundedExclusive.Point); }
public void UnboundedIntervalEndpointNonsensePoint() { var unbounded = new IntervalEndpoint <int>(int.MaxValue); Assert.IsFalse(unbounded.Bounded); Assert.IsFalse(unbounded.Inclusive); // implied by being unbounded Assert.AreEqual(int.MaxValue, unbounded.Point); }
public void BoundedInclusiveIntervalEndpoint() { var boundedInclusive = new IntervalEndpoint <int>(42, true); Assert.IsTrue(boundedInclusive.Bounded); Assert.IsTrue(boundedInclusive.Inclusive); Assert.AreEqual(42, boundedInclusive.Point); }
public Interval(double minimum, double maximum, IntervalEndpoint minimumEndpoint, IntervalEndpoint maximumEndpoint) { if (maximum < minimum) { throw new ArgumentException("maximum < minimum"); } _minimum = minimum; _maximum = maximum; _minimumEndpoint = minimumEndpoint; _maximumEndpoint = maximumEndpoint; }