Exemplo n.º 1
0
        public void HasMinLengthOfT_When_MinLength_Is_Less_Than_Zero_Should_Throw_InvalidOperationException()
        {
            var ex = Assert.Throws <InvalidOperationException>(
                () => Invariant.HasMinLength <int>(new List <int>(), -1, PARAMETER_NAME));

            Assert.AreEqual("Must not specify a min length less than zero.", ex.Message);
        }
Exemplo n.º 2
0
        public void HasMinLengthOfT_When_Argument_Length_Is_Less_Than_MinLength_Should_Throw_ArgumentException()
        {
            const int MIN_LENGTH = 1;

            var ex = Assert.Throws <ArgumentException>(
                () => Invariant.HasMinLength <int>(new List <int>(), MIN_LENGTH, PARAMETER_NAME));

            Assert.AreEqual($"Argument '{PARAMETER_NAME}' must not have length less than {MIN_LENGTH}.", ex.Message);
        }
Exemplo n.º 3
0
 public void HasMinLengthOfT_When_Argument_Length_Exceeds_MinLength_Should_Not_Throw()
 {
     Assert.DoesNotThrow(() => Invariant.HasMinLength <int>(new List <int> {
         1, 2
     }, 1, PARAMETER_NAME));
 }
Exemplo n.º 4
0
 public void HasMinLengthOfT_When_MinLength_Is_Zero_Should_Not_Throw()
 {
     Assert.DoesNotThrow(() => Invariant.HasMinLength <int>(new List <int>(), 0, PARAMETER_NAME));
 }
Exemplo n.º 5
0
 public void HasMinLength_When_Argument_Length_Exceeds_MinLength_Should_Not_Throw()
 {
     Assert.DoesNotThrow(() => Invariant.HasMinLength("aa", 1, PARAMETER_NAME));
 }
Exemplo n.º 6
0
 public void HasMinLength_When_MinLength_Is_Zero_Should_Not_Throw()
 {
     Assert.DoesNotThrow(() => Invariant.HasMinLength(string.Empty, 0, PARAMETER_NAME));
 }