// Prescriptions and past examinations private void PrepareStubs() { _prescriptionStubRepository = new Mock <IMedicationPrescriptionRepository>(); _mockDiagnosisConnection = new Mock <IConnection>(); var allPrescriptions = new List <MedicationPrescription>(); var matchedPrescriptions = new List <MedicationPrescription>(); var prescription1 = new MedicationPrescription() { MedicalRecordId = 1, Medication = new Medication() { Description = "Lek za smirenje", Id = 1, Name = "Bromazepam", Manufacturer = "Pfizer" } }; var prescription2 = new MedicationPrescription() { MedicalRecordId = 2, Medication = new Medication() { Description = "Lek za bolove", Id = 1, Name = "Brufen", Manufacturer = "Pfizer" } }; allPrescriptions.Add(prescription1); allPrescriptions.Add(prescription2); matchedPrescriptions.Add(prescription2); _prescriptionStubRepository.Setup(repository => repository.GetMatching( prescription => prescription.Medication.Name.Contains("Brufen"))) .Returns(matchedPrescriptions); _prescriptionStubRepository.Setup(repository => repository.GetMatching( prescription => prescription.Medication.Name.Contains("Br"))) .Returns(allPrescriptions); _mockDiagnosisConnection.Setup(connection => connection .Post <List <Diagnosis> >(It.IsAny <IEnumerable <int> >())).Returns( new List <Diagnosis> { new Diagnosis { Name = "a" } }); }
protected Patient GetAndValidatePatient(MedicationPrescription medicationPrescription) { var patient = FhirBase.Read(ResourceType.Patient.ToString(), medicationPrescription.Patient.ExtractId()) as Patient; if (patient == null) { throw new FhirHttpResponseException(HttpStatusCode.NotFound, "Пациент, на которого ссылается MedicationPrescription, не найден"); } if (patient.Active != true) { throw new FhirHttpResponseException(HttpStatusCode.BadRequest, "Пациент, на которого ссылается MedicationPrescription, не активный"); } return(patient); }