Example #1
0
            public void UInt32_ShouldReturnExpectedResul(uint value, uint lowerBound, uint upperBound, uint expected)
            {
                // Act
                var actual = IntegerMath.Clamp(value, lowerBound, upperBound);

                // Assert
                Assert.Equal(expected, actual);
            }
Example #2
0
            public void Int64_ShouldReturnExpectedResul(long value, long lowerBound, long upperBound, long expected)
            {
                // Act
                var actual = IntegerMath.Clamp(value, lowerBound, upperBound);

                // Assert
                Assert.Equal(expected, actual);
            }
Example #3
0
            public void UInt32_ShouldThrowArgumentOutOfRangeException_WhenLowerBoundIsGreaterThanUpperBound()
            {
                // Act
                var exception = Record.Exception(() =>
                {
                    IntegerMath.Clamp((uint)20, (uint)20, (uint)0);
                });

                // Assert
                Assert.IsType <ArgumentOutOfRangeException>(exception);
            }