public void Shorter_name_than_the_specification_throws_validation_error() { var target = new ShortStringTarget { Name = "Bart" }; NotificationMessage[] messages = Validator.ValidateField(target, "Name"); messages.Length.ShouldEqual(1); NotificationMessage message = messages[0]; message.FieldName.ShouldEqual("Name"); message.Message.ShouldEqual("Name cannot be shorter than 6 characters"); }
public void Short_name_less_than_specified_length_does_not_throw_any_validation_errors() { var target = new ShortStringTarget { Name = "Jeremy" }; Validator.ValidateObject(target).AllMessages.Length.ShouldEqual(0); }
public void Null_does_not_throw_any_validation_errors() { var target = new ShortStringTarget { Name = null }; Validator.ValidateObject(target).AllMessages.Length.ShouldEqual(0); }