Skip to content

Instantly share code, notes, and snippets.

@underwhelmed
Created January 11, 2011 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save underwhelmed/774620 to your computer and use it in GitHub Desktop.
Save underwhelmed/774620 to your computer and use it in GitHub Desktop.
[Test]
public void FailWhenTheFirstNameIsTooLong()
{
var svc = new UserImportValidationService(_userRepo, _divRepo, _jcRepo, _locRepo);
var user = new UserRecord();
user.UserLoginID = "VALID";
user.FirstName = "This is really long and shouldn't be imported because we said that the first name and last name fields should only be less than 50 characters. It's pretty arbitrary, but that's what the database can hold so that's why we're doing it that way. Groundhog Day was a sweet movie.";
Validation val = svc.IsValid(user);
Assert.IsFalse(val.IsValid);
Assert.IsTrue(val.ErrorMessages.Any(w => w.Contains("FirstName is too long")));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment