public void Intersect_should_be_idempotent() { var range1 = new IntegerRange(1, 4); var range2 = new IntegerRange(2, 5); Assert.That(range1.Intersect(range2), Is.EqualTo(range2.Intersect(range1))); }
public void Should_intersect_subset_ranges() { var range1 = new IntegerRange(1, 5); var range2 = new IntegerRange(2, 4); var intersection = range1.Intersect(range2); Assert.That(intersection.Min, Is.EqualTo(2)); Assert.That(intersection.Max, Is.EqualTo(4)); }
public void Should_intersect_partially_overlapping_ranges() { var range1 = new IntegerRange(1, 4); var range2 = new IntegerRange(2, 5); var intersection = range1.Intersect(range2); Assert.That(intersection.Min, Is.EqualTo(2)); Assert.That(intersection.Max, Is.EqualTo(4)); }
public void Should_not_intersect_non_overlapping_ranges() { var range1 = new IntegerRange(1, 4); var range2 = new IntegerRange(5, 8); range1.Intersect(range2); }