Beispiel #1
0
        public void SetName(string name)
        {
            DomainPreconditions.NotNull(name, nameof(name));
            DomainPreconditions.LongerThan(name, NAME_MAX_LENGTH, nameof(name));

            Name = name;
        }
Beispiel #2
0
 private static void ValidateModel(string model)
 {
     DomainPreconditions.NotNull(model, nameof(Model));
     DomainPreconditions.NotEmpty(model, nameof(Model));
     DomainPreconditions.LongerThan(model, ModelMaxLengh, nameof(Model));
 }
Beispiel #3
0
 private static void ValidateLicensePlate(string licensePlate)
 {
     DomainPreconditions.NotNull(licensePlate, nameof(LicensePlate));
     DomainPreconditions.NotEmpty(licensePlate, nameof(LicensePlate));
     DomainPreconditions.LongerThan(licensePlate, LicensePlateMaxLengh, nameof(LicensePlate));
 }
Beispiel #4
0
 private static void ValidateCarFrame(string carFrame)
 {
     DomainPreconditions.NotNull(carFrame, nameof(CarFrame));
     DomainPreconditions.NotEmpty(carFrame, nameof(CarFrame));
     DomainPreconditions.LongerThan(carFrame, CarFrameMaxLengh, nameof(CarFrame));
 }
Beispiel #5
0
 private static void ValidateBirthdate(DateTime birthdate)
 {
     DomainPreconditions.EarlierThan(birthdate, BirthdateMaxDate, nameof(Birthdate));
     DomainPreconditions.LaterThan(birthdate, BirthdateMinDate, nameof(Birthdate));
 }
Beispiel #6
0
 private static void ValidateName(string name)
 {
     DomainPreconditions.NotEmpty(name, nameof(name));
     DomainPreconditions.LongerThan(name, NameMaxLength, nameof(Name));
     DomainPreconditions.ShorterThan(name, NameMinLength, nameof(Name));
 }
Beispiel #7
0
 private static void ValidateEmail(string email)
 {
     DomainPreconditions.NotEmpty(email, nameof(Email));
     DomainPreconditions.RegexMatch(email, EmailRegex, nameof(Email));
     DomainPreconditions.LongerThan(email, EmailMaxLength, nameof(Email));
 }
Beispiel #8
0
 private static void ValidateGender(int genderId) =>
 DomainPreconditions.IsIntInIntList(Gender.GetGenders().Select(r => r.Id), genderId, nameof(genderId));