示例#1
0
        public void RangeIIOutTest()
        {
            var result = RunTest(Int.Range(0, int.MaxValue, out var value),
                                 () => MyClass.M1(value));

            Assert.That(result, Is.EqualTo(value));
        }
示例#2
0
 public void Range_MinGreaterThanMax()
 {
     // Act & Assert
     Assert.Throws(typeof(ArgumentException),
                   // ReSharper disable once ObjectCreationAsStatement
                   () => Int.Range(20, 10));
 }
示例#3
0
        public void Range_MinLowerThanMax()
        {
            // Act
            var range = Int.Range(10, 20);

            // Assert
            AssertChunks(range, 10, 20);
        }
示例#4
0
        public void Range_MinEqualToMax()
        {
            // Act
            var range = Int.Range(10, 10);

            // Assert
            AssertChunks(range, 10, 10);
        }
示例#5
0
        public void RangeIITestOutTwice()
        {
            var result = RunTest(Int.Range(1, int.MaxValue)
                                 .Range(int.MinValue, -1, out var value),
                                 () => MyClass.M2(value));

            Assert.That(result, Is.EqualTo(value));
        }
示例#6
0
        public void AddChunk_Error()
        {
            // Arrange
            var range = Int.Range(10, 20);

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

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

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

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

            // Assert
            AssertChunks(range, 10, 20, 30, int.MaxValue);
        }
示例#8
0
        public void AddChunk_AfterMax()
        {
            // Arrange
            var range = Int.Range(10, 20);

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

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

            // Assert
            AssertChunks(range, 10, 20, 30, 40);
        }
示例#9
0
        public void AddChunk_MaxImmediatelyAfterMax()
        {
            // Arrange
            var range = Int.Range(10, 20);

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

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

            // Assert
            AssertChunks(range, 10, 21);
        }
示例#10
0
        public void AddChunk_ContainingMax()
        {
            // Arrange
            var range = Int.Range(10, 20);

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

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

            // Assert
            AssertChunks(range, 10, 25);
        }
示例#11
0
        public void AddChunk_BetweenMinMax()
        {
            // Arrange
            var range = Int.Range(10, 20);

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

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

            // Assert
            AssertChunks(range, 10, 20);
        }
示例#12
0
        public void AddChunk_MinImmediatelyBeforeMin()
        {
            // Arrange
            var range = Int.Range(10, 20);

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

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

            // Assert
            AssertChunks(range, 9, 20);
        }
示例#13
0
        public void AddChunk_ContainingMin()
        {
            // Arrange
            var range = Int.Range(10, 20);

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

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

            // Assert
            AssertChunks(range, 5, 20);
        }
示例#14
0
        public void AddChunk_BeforeMin()
        {
            // Arrange
            var range = Int.Range(10, 20);

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

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

            // Assert
            AssertChunks(range, 5, 8, 10, 20);
        }
示例#15
0
        public void AddChunk_InfinityBeforeMin()
        {
            // Arrange
            var range = Int.Range(10, 20);

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

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

            // Assert
            AssertChunks(range, int.MinValue, 8, 10, 20);
        }
示例#16
0
        public void AddChunk2_ContainingMax1_ContainingMinMax2()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

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

            // Assert
            AssertChunks(range, 10, 42);
        }
示例#17
0
        public void AddChunk2_ImmediatelyBeforeMin1()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

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

            // Assert
            AssertChunks(range, 5, 20, 30, 40);
        }
示例#18
0
        public void AddChunkThatCompleteBoth()
        {
            // Arrange
            var range = Int.Range(1, int.MaxValue);

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

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

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

            // Assert
            AssertChunks(range, int.MinValue, int.MaxValue);
        }
示例#19
0
        public void AddChunk2_ImmediatelyAfterMax2_Infinity()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

            // Act
            range.Range(41, int.MaxValue);

            // Assert
            AssertChunks(range, 10, 20, 30, int.MaxValue);
        }
示例#20
0
        public void AddChunk2_ImmediatelyAfterMax2_AfterMax2()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

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

            // Assert
            AssertChunks(range, 10, 20, 30, 46);
        }
示例#21
0
        public void AddChunk2_BetweenMinMax2_Infinity()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

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

            // Assert
            AssertChunks(range, 10, 20, 30, int.MaxValue);
        }
示例#22
0
        public void AddChunk2_BetweenMinMax2_AfterMax2()
        {
            // Arrange
            var range = Int.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);
        }
示例#23
0
        public void AddChunk2_ContainingMinMax1_ImmediatelyBeforeMin2()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

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

            // Assert
            AssertChunks(range, 5, 40);
        }
示例#24
0
        public void AddChunk2_AfterMax1_ImmediatelyBeforeMin2()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

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

            // Assert
            AssertChunks(range, 10, 20, 23, 40);
        }
示例#25
0
        public void AddChunk2_ImmediatelyAfterMax1_BetweenMinMax2()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

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

            // Assert
            AssertChunks(range, 10, 40);
        }
示例#26
0
        public void AddChunk2_ContainingMinMax1_Infinity()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

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

            // Assert
            AssertChunks(range, 5, int.MaxValue);
        }
示例#27
0
        public void AddChunk2_BetweenMinMax1()
        {
            // Arrange
            var range = Int.Range(10, 20);

            range.Range(30, 40);

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

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

            // Assert
            AssertChunks(range, 10, 20, 30, 40);
        }