public void GivenNullNullRangeAllNumbersAreIn() { var intRange = new NullableRange <int>(null, null); Assert.That(intRange.IsValueInRange(int.MinValue), Is.True); Assert.That(intRange.IsValueInRange(-5), Is.True); Assert.That(intRange.IsValueInRange(-1), Is.True); Assert.That(intRange.IsValueInRange(10), Is.True); Assert.That(intRange.IsValueInRange(int.MaxValue), Is.True); }
public void GivenRangeWithNullLowEndAllLowerNumbersAreIn() { var intRange = new NullableRange <int>(null, 10); Assert.That(intRange.IsValueInRange(int.MinValue), Is.True); Assert.That(intRange.IsValueInRange(1), Is.True); Assert.That(intRange.IsValueInRange(10), Is.True); Assert.That(intRange.IsValueInRange(11), Is.False); Assert.That(intRange.IsValueInRange(int.MaxValue), Is.False); }
public void GivenRangeWithNullHighEndEverythingFromThereUpIsIn() { var intRange = new NullableRange <int>(-1, null); Assert.That(intRange.IsValueInRange(int.MinValue), Is.False); Assert.That(intRange.IsValueInRange(-5), Is.False); Assert.That(intRange.IsValueInRange(-1), Is.True); Assert.That(intRange.IsValueInRange(10), Is.True); Assert.That(intRange.IsValueInRange(int.MaxValue), Is.True); }
public void ContainsValueTest() { var intRange = new NullableRange <int>(1, 7); Assert.That(intRange.IsValueInRange(0), Is.False); Assert.That(intRange.IsValueInRange(1), Is.True); Assert.That(intRange.IsValueInRange(2), Is.True); Assert.That(intRange.IsValueInRange(3), Is.True); Assert.That(intRange.IsValueInRange(7), Is.True); Assert.That(intRange.IsValueInRange(8), Is.False); }
public bool OverlapsWithOtherRange(NullableRange <T> rhs) { return(rhs.IsValueInRange(_maximum) || IsValueInRange(rhs._maximum) || rhs.IsValueInRange(_minimum) || IsValueInRange(rhs._minimum)); }