Ejemplo n.º 1
0
        private Patient ReadClient(ISheet sheet)
        {
            var patient = new ExaminationPatient(sheet);

            if (!DateTime.TryParse(patient.Birthday, out DateTime birthday))
            {
                var pesel = new Pesel(patient.Pesel);
                birthday = pesel.GetBirthday();
            }

            var materialRegistrationDate = DateTime.Parse(patient.MaterialRegistrationDate);

            if (materialRegistrationDate == DateTime.MinValue)
            {
                throw new ArgumentException($"Material registration date is empty for {patient.Name}!");
            }

            var client = new Patient
            {
                Birthday = birthday,
                Gender   = Converter.SetGender(patient.Gender),
                Id       = Hash.Generate(patient.Pesel),
                Address  = patient.Address,
                MaterialRegistrationDate = materialRegistrationDate
            };

            return(client);
        }
Ejemplo n.º 2
0
        public void Is_birthday_valid(string peselString, int year, int month, int day)
        {
            // Arrange
            DateTime birthday = new DateTime(year, month, day);

            // Act
            AssertIsPeselValid(peselString);

            var      pesel         = new Pesel(peselString);
            DateTime peselBirthday = pesel.GetBirthday();

            // Assert
            Assert.That(peselBirthday, Is.EqualTo(birthday));
        }