public void HasLength_When_matching_constraint_It_should_not_throw() { var value = "Some string"; ShouldNotThrow( () => Ensure.String.HasLength(value, value.Length, ParamName), () => EnsureArg.HasLength(value, value.Length, ParamName)); }
public void HasLength_When_null_It_throws_ArgumentNullException() { string value = null; var expected = 1; AssertIsNotNull( () => Ensure.String.HasLength(value, expected, ParamName), () => EnsureArg.HasLength(value, expected, ParamName), () => Ensure.That(value, ParamName).HasLength(expected)); }
public void HasLength_When_non_matching_length_of_string_It_throws_ArgumentException() { var value = "Some string"; var expected = value.Length + 1; ShouldThrow <ArgumentException>( string.Format(ExceptionMessages.Strings_SizeIs_Failed, expected, value.Length), () => Ensure.String.HasLength(value, expected, ParamName), () => EnsureArg.HasLength(value, expected, ParamName), () => Ensure.That(value, ParamName).HasLength(expected)); }