public void Range_MinGreaterThanMax()
 {
     // Act & Assert
     Assert.Throws(typeof(ArgumentException),
                   // ReSharper disable once ObjectCreationAsStatement
                   () => DoubleRange.Range(20, 10));
 }
        public void Range_MinLowerThanMax()
        {
            // Act
            var range = DoubleRange.Range(10, 20);

            // Assert
            AssertChunks(range, 10, 20);
        }
        public void Range_MinEqualToMax()
        {
            // Act
            var range = DoubleRange.Range(10, 10);

            // Assert
            AssertChunks(range, 10, 10);
        }
        public void AddChunk_ImmediatelyBeforeMin1()
        {
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(_Before10, _Before10);

            // Assert
            AssertChunks(range, _Before10, 20);
        }
        public void AddChunk_Error()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act & Assert
            Assert.Throws(typeof(ArgumentException),
                          // ReSharper disable once ObjectCreationAsStatement
                          () => range.Range(20, 10));
        }
        public void AddChunk_AfterMaxInfinity()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(30, double.MaxValue);

            // Assert
            AssertChunks(range, 10, 20, 30, double.MaxValue);
        }
        public void AddChunk_AfterMax()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(30, 40);

            // Assert
            AssertChunks(range, 10, 20, 30, 40);
        }
        public void AddChunk_MaxImmediatelyAfterMax()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(15, _After20);

            // Assert
            AssertChunks(range, 10, _After20);
        }
        public void AddChunk_ContainingMax()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(12, 25);

            // Assert
            AssertChunks(range, 10, 25);
        }
        public void AddChunk_BetweenMinMax()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(12, 14);

            // Assert
            AssertChunks(range, 10, 20);
        }
        public void AddChunk_ContainingMin()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(5, 14);

            // Assert
            AssertChunks(range, 5, 20);
        }
        public void AddChunk_MinImmediatelyBeforeMin()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(_Before10, 15);

            // Assert
            AssertChunks(range, _Before10, 20);
        }
        public void AddChunk_InfinityBeforeMin()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(double.MinValue, 8);

            // Assert
            AssertChunks(range, double.MinValue, 8, 10, 20);
        }
        public void AddChunk_BeforeMin()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(5, 8);

            // Assert
            AssertChunks(range, 5, 8, 10, 20);
        }
        public void AddChunk2_ContainingMinMax1_Infinity()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(5, double.MaxValue);

            // Assert
            AssertChunks(range, 5, double.MaxValue);
        }
        public void AddChunk2_ImmediatelyAfterMax2_Infinity()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(_After40, double.MaxValue);

            // Assert
            AssertChunks(range, 10, 20, 30, double.MaxValue);
        }
        public void AddChunkThatCompleteBoth()
        {
            // Arrange
            var range = DoubleRange.Range(1, double.MaxValue);

            range.Range(double.MinValue, -1);

            // Assume
            AssertChunks(range, double.MinValue, -1, 1, double.MaxValue);

            // Act
            range.Range(BitConverterHelper.Next((double)-1), BitConverterHelper.Previous((double)1));

            // Assert
            AssertChunks(range, double.MinValue, double.MaxValue);
        }
        public void AddChunk2_BetweenMinMax2_AfterMax2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(34, 46);

            // Assert
            AssertChunks(range, 10, 20, 30, 46);
        }
        public void AddChunk2_BetweenMinMax2_Infinity()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(34, double.MaxValue);

            // Assert
            AssertChunks(range, 10, 20, 30, double.MaxValue);
        }
        public void AddChunk2_ImmediatelyBeforeMin1()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(5, _Before10);

            // Assert
            AssertChunks(range, 5, 20, 30, 40);
        }
        public void AddChunk2_AfterMax1_ImmediatelyBeforeMin2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(23, _Before30);

            // Assert
            AssertChunks(range, 10, 20, 23, 40);
        }
        public void AddChunk2_ContainingMinMax1_ImmediatelyBeforeMin2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(5, _Before30);

            // Assert
            AssertChunks(range, 5, 40);
        }
        public void AddChunk2_ImmediatelyAfterMax1_AfterMax2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(_After20, 45);

            // Assert
            AssertChunks(range, 10, 45);
        }
        public void AddChunk2_ContainingMax1_ContainingMinMax2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(15, 42);

            // Assert
            AssertChunks(range, 10, 42);
        }