public void Validate(Graphic graphic) { if (graphic == null) { throw new ArgumentNullException(NULL_GRAPHIC); } _breedsRepository.Validate(graphic.Breed); if (graphic.Term < 0) { throw new ArgumentException(string.Format(WRONG_TERM, graphic.Term)); } _vaccinesRepository.Validate(graphic.Vaccine); }
public void Validate(Animal animal) { if (animal == null) { throw new ArgumentNullException(NULL_ANIMAL); } if (animal.Birthday >= DateTime.Today.AddDays(1)) { throw new ArgumentException(string.Format(WRONG_BIRTHDAY, animal.Birthday)); } _breedsRepository.Validate(animal.Breed); if (string.IsNullOrWhiteSpace(animal.Name)) { throw new ArgumentException(ANIMAL_NAME_NULL_OR_EMPTY); } _usersRepository.Validate(animal.User); }