public void should_Post() { // Arrange Assert.That(_patientWithEncounter, Is.Not.Null); var controller = new PatientController(_patientService); // Act controller.Post(PateintDTO.Create(_patientWithEncounter)); // Assert _uow = new UnitOfWork(new SyncContext()); _patientService = new PatientService(_uow, new EmrRepository(), _createEmrPatientHandler, _createEmrEncounterHandler); var newPatient = _patientService.GetAll().FirstOrDefault(x => x.UuId == _patientWithEncounter.UuId); Assert.NotNull(newPatient); Assert.AreEqual(_patientWithEncounter.Lastname, newPatient.Lastname); Debug.Print(newPatient.ToString()); var iqpatient = _emrRepository.GetPatient(newPatient.UuId); Assert.NotNull(iqpatient); testIQPatientId = iqpatient.Id; Assert.That(iqpatient.FirstName, Is.EqualTo(_patientWithEncounter.Firstname)); Assert.That(iqpatient.MiddleName, Is.EqualTo(_patientWithEncounter.Middlename)); Assert.That(iqpatient.LastName, Is.EqualTo(_patientWithEncounter.Lastname)); Assert.That(iqpatient.SyncId, Is.EqualTo(_patientWithEncounter.UuId)); Debug.Print($"IQCare:{iqpatient.ToStringDetail()}"); }
// POST: api/Patient public void Post(PateintDTO patientDto) { Log.Debug($"posting... {patientDto}"); var patient = patientDto.GeneratePatient(_iqmStore); _patientService.Sync(patient, false);//.Wait(); //_patientService.SyncAsync(patient, false, new CancellationTokenSource());//.Wait(); Log.Debug($"patient {patientDto} posted !"); }