Permalink
Browse files

support uniq validator message customization

  • Loading branch information...
1 parent 5701ffe commit 78a662720c982411bbf198ad7a3353e3c995d9d9 @radiy radiy committed Sep 2, 2011
@@ -414,8 +414,7 @@ public void IsUnique2()
String[] messages = blog.ValidationErrorMessages;
Assert.IsTrue(messages.Length == 1);
- Assert.AreEqual("Id is currently in use. Please pick up a new Id.", messages[0]);
- //Assert.AreEqual("The ID you specified already exists.", messages[0]); //TODO: Fix it (custom validation messages).
+ Assert.AreEqual("The ID you specified already exists.", messages[0]);
blog.Create();
}
@@ -128,6 +128,8 @@ private object CheckUniqueness(ISession session, object instance)
/// <returns></returns>
protected override string BuildErrorMessage()
{
+ if (!String.IsNullOrEmpty(ErrorMessage))
+ return ErrorMessage;
return String.Format("{0} is currently in use. Please pick up a new {0}.", Property.Name);
}

0 comments on commit 78a6627

Please sign in to comment.