public override bool Equals(object obj) { if ((obj == null) || !this.GetType().Equals(obj.GetType())) { return(false); } else { DriverLicenseDate date = (DriverLicenseDate)obj; return(this.date.Equals(date.date)); } }
public DriverLicense(string numberDriverLicense, string driverLicenseDate) { if (StringValidator.isStringEmptyOrNull(numberDriverLicense)) { throw new BusinessRuleValidationException(numberDriverLicense + " :invalid. The number of the license driver can't be null or empty"); } if (StringValidator.isStringEmptyOrNull(driverLicenseDate)) { throw new BusinessRuleValidationException(driverLicenseDate + " :invalid. The date of the license driver can't be null or empty"); } this.Id = new DriverLicenseId(Guid.NewGuid()); this.driverLicenseDate = new DriverLicenseDate(driverLicenseDate); this.numberDriverLicense = new NumberLicense(numberDriverLicense); }