Example #1
0
 public Range(
     T low,
     T high)
 {
     Range.AssertIsValid(low, high);
     Low  = low;
     High = high;
 }
Example #2
0
    public static void CheckValidity(double low, double high)
    {
        Range.IsValid(low, high).Should().BeTrue();

        var a = Boundary.Create(low, true);

        Range.IsValid(a, a).Should().BeTrue();

        var b = Boundary.Create(high, true);

        Range.AssertIsValid(a, b).Should().BeTrue();

        var c = Boundary.Create(low, false);

        Range.IsValid(c, b).Should().BeTrue();
        Range.IsValid(c, a).Should().BeFalse();
        Range.IsValid(c, c).Should().BeFalse();
        Assert.Throws <ArgumentException>(() => Range.AssertIsValid(a, c));

        var d = Boundary.Create(high, false);

        Range.IsValid(b, d).Should().BeFalse();
    }