public void SetCandidateNames(Guid id, string surname, string forenames)
{
if (string.IsNullOrWhiteSpace(surname))
{
throw new ArgumentException("Surname must have a value.", "surname");
}
if (string.IsNullOrWhiteSpace(forenames))
{
throw new ArgumentException("Forenames must have a value.", "forenames");
}
var existingResult = this.results.Single(r => r.Id == id);
var newResult = new AssessmentResult(id, surname, forenames, existingResult.Result);
if (this.results.Where(r => r.Id != existingResult.Id).Any(r => r.Surname == surname && r.Forenames == forenames))
{
throw new UniqueConstraintException(string.Format("A candidate with name \"{0}, {1}\" alread exists.", surname, forenames));
}
this.results.Remove(existingResult);
this.results.Add(newResult);
}