public void UnionWith_WhenOtherIntervalContainsThisInterval_ReturnsOtherInterval() { var intervalA = new IntegerInterval(1, false, 2, false); var intervalB = new IntegerInterval(0, false, 3, false); var actual = intervalA.UnionWith(intervalB); Assert.That(actual, Is.EquivalentTo(new[] { intervalB })); }
public void UnionWith_WhenIntervalsIntersectAtAnExcludedPoint_ReturnsBothIntervals() { var intervalA = new IntegerInterval(0, false, 2, false); var intervalB = new IntegerInterval(2, false, 3, false); var actual = intervalA.UnionWith(intervalB); Assert.That(actual, Is.EquivalentTo(new[] { intervalA, intervalB })); }
public void UnionWith_WithOtherIntervalEmpty_ReturnsThisInterval() { var intervalA = new IntegerInterval(1, false, 3, false); var intervalB = new IntegerInterval(0, false, 0, false); var actual = intervalA.UnionWith(intervalB); Assert.That(actual, Is.EquivalentTo(new[] { intervalA })); }
public void UnionWith_WithTwoEmptySets_ReturnsNull() { IntegerInterval intervalA = null; IntegerInterval intervalB = null; var actual = intervalA.UnionWith(intervalB); Assert.That(actual, Is.Null); }
public void UnionWith_WhenIntervalsOverlap_ReturnsASingleIntervalThatContainsBothIntervals() { var intervalA = new IntegerInterval(0, false, 2, false); var intervalB = new IntegerInterval(1, false, 3, false); var actual = intervalA.UnionWith(intervalB); var single = actual.Single(); // Asserts that the array contains a single entry. Assert.That(single.Contains(intervalA)); Assert.That(single.Contains(intervalB)); }
public void UnionWith_WhenIntervalsIntersectAtAnIncludedPoint_ReturnsASingleIntervalThatContainsBothIntervals(bool aEndInclusive, bool bStartInclusive) { Assume.That(aEndInclusive || bStartInclusive); var intervalA = new IntegerInterval(0, false, 2, aEndInclusive); var intervalB = new IntegerInterval(2, bStartInclusive, 3, false); var actual = intervalA.UnionWith(intervalB); var single = actual.Single(); // Asserts that the array contains a single entry. Assert.That(single.Contains(intervalA)); Assert.That(single.Contains(intervalB)); }
public void UnionWith_WithThisIntervalEmpty_ReturnsOtherInterval() { var intervalA = new IntegerInterval(0, false, 0, false); var intervalB = new IntegerInterval(1, false, 3, false); var actual = intervalA.UnionWith(intervalB); Assert.That(actual, Is.EquivalentTo(new[] { intervalB })); }
public void UnionWith_WhenThisIntervalContainsOtherInterval_ReturnsThisInterval() { var intervalA = new IntegerInterval(0, false, 3, false); var intervalB = new IntegerInterval(1, false, 2, false); var actual = intervalA.UnionWith(intervalB); Assert.That(actual, Is.EquivalentTo(new[] { intervalA })); }