public void HasMaxLengthOfT_When_MaxLength_Is_Less_Than_Zero_Should_Throw_InvalidOperationException() { var ex = Assert.Throws <InvalidOperationException>( () => Invariant.HasMaxLength <int>(new List <int>(), -1, PARAMETER_NAME)); Assert.AreEqual("Must not specify a max length less than zero.", ex.Message); }
public void HasMaxLength_When_Argument_Length_Exceeds_MaxLength_Should_Throw_ArgumentException() { const int MAX_LENGTH = 0; var ex = Assert.Throws <ArgumentException>( () => Invariant.HasMaxLength("a", MAX_LENGTH, PARAMETER_NAME)); Assert.AreEqual($"Argument '{PARAMETER_NAME}' must not have length greater than {MAX_LENGTH}.", ex.Message); }
public void HasMaxLengthOfT_When_MaxLength_Is_Zero_Should_Not_Throw() { Assert.DoesNotThrow(() => Invariant.HasMaxLength <int>(new List <int>(), 0, PARAMETER_NAME)); }
public void HasMaxLength_When_Argument_Length_Is_Less_Than_MaxLength_Should_Not_Throw() { Assert.DoesNotThrow(() => Invariant.HasMaxLength("a", 2, PARAMETER_NAME)); }
public void HasMaxLength_When_MaxLength_Is_Zero_Should_Not_Throw() { Assert.DoesNotThrow(() => Invariant.HasMaxLength(string.Empty, 0, PARAMETER_NAME)); }
public void HasMaxLengthOfT_When_Argument_Length_Is_Less_Than_MaxLength_Should_Not_Throw() { Assert.DoesNotThrow(() => Invariant.HasMaxLength <int>(new List <int> { 1 }, 2, PARAMETER_NAME)); }