Ejemplo n.º 1
0
        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 }));
        }
Ejemplo n.º 2
0
        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 }));
        }
Ejemplo n.º 3
0
        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 }));
        }
Ejemplo n.º 4
0
        public void UnionWith_WithTwoEmptySets_ReturnsNull()
        {
            IntegerInterval intervalA = null;
            IntegerInterval intervalB = null;

            var actual = intervalA.UnionWith(intervalB);

            Assert.That(actual, Is.Null);
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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 }));
        }
Ejemplo n.º 8
0
        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 }));
        }
Ejemplo n.º 9
0
        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));
        }
Ejemplo n.º 10
0
        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));
        }
Ejemplo n.º 11
0
        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 }));
        }