예제 #1
0
        public Person(string name, string surname, string email, DateTime birthday)
        {
            Name     = name;
            Surname  = surname;
            Email    = email;
            Birthday = birthday;

            _sunSign     = ZodiacHelper.GetSunSign(Birthday);
            _chineseSign = ZodiacHelper.GetChineseSign(Birthday);
        }
예제 #2
0
        public Person(string name, string surname, string email, DateTime birthday)
        {
            if (EmailValidator.ValidateEmail(email))
            {
                throw new InvalidEmailException(email);
            }

            var yearsDif = (DateTime.Today - birthday).TotalDays / 365;

            if (yearsDif < 0 || yearsDif > 120)
            {
                throw new InvalidBirthdayException(birthday);
            }

            Name     = name;
            Surname  = surname;
            Email    = email;
            Birthday = birthday;

            _sunSign     = ZodiacHelper.GetSunSign(Birthday);
            _chineseSign = ZodiacHelper.GetChineseSign(Birthday);
        }