public void GetPatientByID_Failure_Test() { // check to see if this id is registered in APISession in mongodb. // you will need to make sure there is a token registration for token '1234' //with userid = 'BB241C64-A0FF-4E01-BA5F-4246EF50780E' in APIUserToken table for this to work. string token = "52792478fe7a592338e990a1"; string lnControlValue = "Jones"; string fnControlValue = "James"; string lnsampleValue; string fnsampleValue; string patientID = "52781cd8fe7a5925fcee5bf3"; IRestClient client = new JsonServiceClient(); GetPatientResponse response = client.Post <GetPatientResponse>("http://localhost:888/1.0/NG/InHealth001/patient", new GetPatientRequest { PatientID = patientID, Token = token } as object); lnsampleValue = response.Patient.LastName; fnsampleValue = response.Patient.FirstName; Assert.AreEqual(lnControlValue, lnsampleValue); Assert.AreEqual(fnControlValue, fnsampleValue); }
public void GetPatientByID_Test() { // check to see if this id is registered in APISession in mongodb. // you will need to make sure there is a token registration for token '1234' //with userid = 'BB241C64-A0FF-4E01-BA5F-4246EF50780E' in APIUserToken table for this to work. string token = "52792478fe7a592338e990a0"; string lnControlValue = "Johnson"; string fnControlValue = "Greg"; string gnControlValue = "M"; string dobControlValue = "2/15/1975"; string lnsampleValue; string fnsampleValue; string gnsampleValue; string dobsampleValue; string patientID = "528f6dc2072ef708ecd90e87"; IRestClient client = new JsonServiceClient(); //JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("APIToken: {0}", token)); GetPatientResponse response = client.Get <GetPatientResponse>(string.Format("http://localhost:888/Nightingale/1.0/InHealth001/patient/{0}?token={1}", patientID, token)); lnsampleValue = response.Patient.LastName; fnsampleValue = response.Patient.FirstName; gnsampleValue = response.Patient.Gender; dobsampleValue = response.Patient.DOB; Assert.AreEqual(lnControlValue, lnsampleValue); Assert.AreEqual(fnControlValue, fnsampleValue); Assert.AreEqual(fnControlValue, fnsampleValue); Assert.AreEqual(fnControlValue, fnsampleValue); Assert.AreEqual(gnControlValue, gnsampleValue); Assert.AreEqual(dobControlValue, dobsampleValue); }
public GetPatientResponse getById(GetPatientRequest request) { try { var response = new GetPatientResponse(); var bc = new PatientComponent(); response.Result = bc.Find(request.Patient.Id); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
public void Post_Test() { ISecurityManager ism = SecurityManagerFactory.Get(); INGManager ingm = NGManagerFactory.Get(); NGService ngs = new NGService { Security = ism, NGManager = ingm }; GetPatientRequest request = new GetPatientRequest { ContractNumber = "NG", PatientID = "", Token = "dsafgsdfgdafg", UserId = "", Version = 1.0 }; //((ServiceStack.ServiceInterface.Service)ngs). GetPatientResponse response = ngs.Get(request); Assert.Fail(); }
public void GetPatientByID_Test() { // Arrange double version = 1.0; string contractNumber = "InHealth001"; string token = "1234"; NGManager ngManager = new NGManager() { PlanElementUtils = new PlanElementUtils() }; GetPatientRequest request = new GetPatientRequest { ContractNumber = contractNumber, Token = token, Version = version, PatientID = "5325db50d6a4850adcbba8e6", UserId = "5325c821072ef705080d3488" }; // Act GetPatientResponse response = ngManager.GetPatient(request); //Assert Assert.IsTrue(response.Patient != null); }