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)); }
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); }
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); }
private List<Doctor> RemoveDoctorsOfPatient(List<Doctor> result, Patient patientEntity) { return (from d in result where !patientEntity.Doctors.Contains(d, new EntityEqualityComparer()) select d).ToList(); }
private bool NotIn(Patient patient, Doctor toCheck) { return (from d in patient.Doctors where d.Id == toCheck.Id select d).Count() == 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); }
private bool UpdateParent(LightPatientDto member, Patient entity) { return new Updator(this.Session).UpdateParent(member, entity); }
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; }
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(); }
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); }
private string GetAge(Patient patient) { var timeSpan = DateTime.Now - patient.BirthDate; return (timeSpan.Days / 365).ToString(); }
public MacroBuilder(Patient patient) { this.patient = patient; }
private static MedicalRecordCabinetDto CustomConversion(Patient src) { var cabinet = new MedicalRecordCabinetDto(); cabinet.Folders.Refill(BuildFolders(src.MedicalRecords)); return cabinet; }