public IActionResult CreatePatient(string patientData) { try { evaluator.CreatePatient(patientData); return(Ok()); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void Test_CreatePatient() { // Arrange var evaluator = new PatientsEvaluator(context); // Act evaluator.CreatePatient(patientDataString); // Assert var newPatient = (from patient in context.Patients where patient.FirstName == "Tim" && patient.LastName == "Apple" select patient).First(); var newPatientImpl = (from patientimpl in context.Patients_Impl where patientimpl.Id == newPatient.Id select patientimpl).First(); var newPatientData = JsonConvert.DeserializeObject <Dictionary <string, string> >(newPatientImpl.Data); Assert.Equal(newPatientData["someData"], "Frequently"); }