예제 #1
0
        public void IsInInterval_When_Argument_Exceeds_Max_Should_Throw_ArgumentException()
        {
            const int MAX_VALUE = 2;

            var ex = Assert.Throws <ArgumentException>(
                () => Invariant.IsInInterval(MAX_VALUE + 1, MAX_VALUE - 1, MAX_VALUE, PARAMETER_NAME));

            Assert.AreEqual($"Argument '{PARAMETER_NAME}' must not be greater than {MAX_VALUE}.", ex.Message);
        }
예제 #2
0
        public void IsInInterval_When_Argument_Is_Less_Than_Min_Should_Throw_ArgumentException()
        {
            const int MIN_VALUE = 0;

            var ex = Assert.Throws <ArgumentException>(
                () => Invariant.IsInInterval(-1, MIN_VALUE, MIN_VALUE + 1, PARAMETER_NAME));

            Assert.AreEqual($"Argument '{PARAMETER_NAME}' must not be less than {MIN_VALUE}.", ex.Message);
        }
예제 #3
0
        public void IsInInterval_When_Argument_Is_Equal_To_Max_Should_Not_Throw()
        {
            const int MAX_VALUE = 2;

            Assert.DoesNotThrow(() => Invariant.IsInInterval(MAX_VALUE, MAX_VALUE - 1, MAX_VALUE, PARAMETER_NAME));
        }
예제 #4
0
        public void IsInInterval_When_Argument_Exceeds_Min_And_Is_Less_Than_Max_Should_Not_Throw()
        {
            const int MIN_VALUE = 0;

            Assert.DoesNotThrow(() => Invariant.IsInInterval(MIN_VALUE + 1, MIN_VALUE, MIN_VALUE + 2, PARAMETER_NAME));
        }
예제 #5
0
        public void IsInInterval_When_Argument_Is_Equal_To_Min_Should_Not_Throw()
        {
            const int MIN_VALUE = 0;

            Assert.DoesNotThrow(() => Invariant.IsInInterval(MIN_VALUE, MIN_VALUE, MIN_VALUE + 1, PARAMETER_NAME));
        }
예제 #6
0
 public void IsInInterval_When_Max_Exceeds_Than_Min_Should_Not_Throw()
 {
     Assert.DoesNotThrow(() => Invariant.IsInInterval(0, 0, 1, PARAMETER_NAME));
 }
예제 #7
0
 public void IsInInterval_When_Max_Is_Equal_To_Min_Should_Not_Throw()
 {
     Assert.DoesNotThrow(() => Invariant.IsInInterval(0, 0, 0, PARAMETER_NAME));
 }
예제 #8
0
        public void IsInInterval_When_Max_Is_Less_Than_Min_Should_Throw_InvalidOperationException()
        {
            var ex = Assert.Throws <InvalidOperationException>(() => Invariant.IsInInterval(0, 1, 0, PARAMETER_NAME));

            Assert.AreEqual("Max must not be less than min.", ex.Message);
        }