예제 #1
0
        public void CreateMacro_UsingUnknownMarkups_ExceptionIsThrown()
        {
            var macro = "Hello $unknown$ $LASTNAME$";
            var patient = new Patient() { FirstName = "ROBERT", LastName = "DUPONT" };

            var builder = new MacroBuilder(patient);
            Assert.Throws<InvalidMacroException>(() => builder.Resolve(macro));
        }
예제 #2
0
        public void CreateMacro_UsingUpperCaseMarkups_MarkupsReplacesWithValues()
        {
            var robert = "Robert";
            var dupont = "Dupont";

            var macro = "Hello $FIRSTNAME$ $LASTNAME$";
            var expected = "Hello " + robert + " " + dupont;

            var patient = new Patient() { FirstName = robert, LastName = dupont };

            var builder = new MacroBuilder(patient);
            var result = builder.Resolve(macro);

            Assert.AreEqual(expected, result);
        }
예제 #3
0
        public void CreateMacro_ReplaceFullName_MarkupsReplacedWithValue()
        {
            var robert = "Robert";
            var dupont = "Dupont";

            var macro = "Hello $firstname$ $lastname$";
            var expected = "Hello " + robert + " " + dupont;

            var patient = new Patient() { FirstName = robert, LastName = dupont };

            var builder = new MacroBuilder(patient);
            var result = builder.Resolve(macro);

            Assert.AreEqual(expected, result);
        }
예제 #4
0
 private List<Doctor> RemoveDoctorsOfPatient(List<Doctor> result, Patient patientEntity)
 {
     return (from d in result
             where !patientEntity.Doctors.Contains(d, new EntityEqualityComparer())
             select d).ToList();
 }
예제 #5
0
 private bool NotIn(Patient patient, Doctor toCheck)
 {
     return (from d in patient.Doctors
             where d.Id == toCheck.Id
             select d).Count() == 0;
 }
예제 #6
0
        public void MapEntityToDto_MapPatientToRecord_MappingOccured()
        {
            var patient = new Patient();
            patient.MedicalRecords.Add(this.RandomMedicalRecord);

            var cabinet = Mapper.Map<Patient, MedicalRecordCabinetDto>(patient);

            Assert.AreEqual(1, cabinet.Folders.Count);
            Assert.AreEqual(1, cabinet.Folders[0].Records.Count);

            Assert.AreEqual(patient.MedicalRecords[0].CreationDate, cabinet.Folders[0].Records[0].CreationDate);
            Assert.AreEqual(patient.MedicalRecords[0].LastUpdate, cabinet.Folders[0].Records[0].LastUpdate);
            Assert.AreEqual(patient.MedicalRecords[0].Name, cabinet.Folders[0].Records[0].Name);
            Assert.AreEqual(patient.MedicalRecords[0].Rtf, cabinet.Folders[0].Records[0].Rtf);
            Assert.AreEqual(patient.MedicalRecords[0].Tag.Category, cabinet.Folders[0].Records[0].Tag.Category);
            Assert.AreEqual(patient.MedicalRecords[0].Tag.Name, cabinet.Folders[0].Records[0].Tag.Name);
            Assert.AreEqual(patient.MedicalRecords[0].Tag.Notes, cabinet.Folders[0].Records[0].Tag.Notes);
        }
예제 #7
0
 private bool UpdateParent(LightPatientDto member, Patient entity)
 {
     return new Updator(this.Session).UpdateParent(member, entity);
 }
예제 #8
0
 private ObservableCollection<LightPatientDto> GetChildrenAsObservable(Patient patient)
 {
     var children = this.GetChildren(patient);
     var childrenDto = Mapper.Map<IList<Patient>, IList<LightPatientDto>>(children);
     var result = new ObservableCollection<LightPatientDto>();
     result.Refill(childrenDto);
     return result;
 }
예제 #9
0
 private IList<Patient> GetChildren(Patient patient)
 {
     return (from child in this.Session.Query<Patient>()
             where child.Father.Id == patient.Id
                || child.Mother.Id == patient.Id
             select child).ToList();
 }
예제 #10
0
        private IList<LightPatientDto> GetAllFamilyMembers(Patient patient)
        {
            var family = new List<Patient>();
            if (patient.Father != null) family.Add(patient.Father);
            if (patient.Mother != null) family.Add(patient.Mother);

            var children = (from p in this.Session.Query<Patient>()
                            where p.Father.Id == patient.Id
                               || p.Mother.Id == patient.Id
                            select p).ToList();
            family.AddRange(children);
            return Mapper.Map<IList<Patient>, IList<LightPatientDto>>(family);
        }
예제 #11
0
 private string GetAge(Patient patient)
 {
     var timeSpan = DateTime.Now - patient.BirthDate;
     return (timeSpan.Days / 365).ToString();
 }
예제 #12
0
 public MacroBuilder(Patient patient)
 {
     this.patient = patient;
 }
예제 #13
0
 private static MedicalRecordCabinetDto CustomConversion(Patient src)
 {
     var cabinet = new MedicalRecordCabinetDto();
     cabinet.Folders.Refill(BuildFolders(src.MedicalRecords));
     return cabinet;
 }