public void AddHPIDetail_Failure() { //Arrange Mock_PresentIllness(); var addHPIDetailFailure = new PresentIllnessDetailModel { HPIDetailID = -57, HPIID = 1, Comment = "Some comment", Location = "SOme location", Quality = "Living with Family.", HPISeverityID = 1, Duration = " Some duration", Timing = "Some timing", Context = "Some context", EncounterID = null, TakenBy = 1, TakenTime = DateTime.Now, ForceRollback = true }; //Act var addHPIResult = PresentIllnessController.AddHPIDetail(addHPIDetailFailure); var response = addHPIResult as HttpResult <Response <PresentIllnessDetailModel> >; //Assert Assert.IsNotNull(response, "Response can't be null"); Assert.IsNotNull(response.Value, "Response value can't be null"); Assert.IsNotNull(response.Value.DataItems, "Response value can't be null"); Assert.IsTrue(response.Value.DataItems.Count == 1, "HPI details saved for invalid record."); }
public void UpdateHPIDetail_Failure() { //Arrange Mock_PresentIllness(); var updateHPIDetail = new PresentIllnessDetailModel { HPIDetailID = -57, HPIID = 1, Comment = "Some reasonable comment", Location = "SOme different location", Quality = "SOme QUality Updated.", HPISeverityID = 1, Duration = " Some duration", Timing = "Some timing", Context = "Some context", EncounterID = null, TakenBy = 1, TakenTime = DateTime.Now, ForceRollback = true }; //Act var updateHPIResult = PresentIllnessController.UpdateHPIDetail(updateHPIDetail); var response = updateHPIResult as HttpResult <Response <PresentIllnessDetailModel> >; //Assert Assert.IsNotNull(response, "Response can't be null"); Assert.IsNotNull(response.Value, "Response value can't be null"); Assert.IsNotNull(response.Value.DataItems, "DataItems can't be null"); Assert.IsTrue(response.Value.DataItems.Count > 0, "Response must return data items"); Assert.IsTrue(response.Value.DataItems[0].Quality != "Some quality Updated", "HPI updated for invalid data."); }
public void AddHPIDetail_Success() { //Arrange const string url = baseRoute + "AddHPIDetail_Success"; var param = new NameValueCollection(); var srModel = new PresentIllnessDetailModel { HPIDetailID = 57, HPIID = 1, Comment = "Some comment", Location = "SOme location", Quality = "Living with Family.", HPISeverityID = 1, Duration = " Some duration", Timing = "Some timing", Context = "Some context", EncounterID = null, TakenBy = 1, TakenTime = DateTime.Now, ForceRollback = true }; //Act var response = _communicationManager.Post <PresentIllnessDetailModel, Response <PresentIllnessDetailModel> >(srModel, url); // Assert Assert.IsNotNull(response, "Response can not be null"); Assert.IsTrue(response.RowAffected > 2, "HPI could not be created."); }
public static PresentIllnessDetailModel ToModel(this PresentIllnessDetailViewModel entity) { if (entity == null) { return(null); } var model = new PresentIllnessDetailModel { TakenBy = entity.TakenBy, TakenTime = entity.TakenTime, ContactID = entity.ContactID, HPIID = entity.HPIID, HPIDetailID = entity.HPIDetailID, Comment = entity.Comment, Location = entity.Location, Quality = entity.Quality, HPISeverityID = entity.HPISeverityID, Duration = entity.Duration, Timing = entity.Timing, Context = entity.Context, Modifyingfactors = entity.Modifyingfactors, Symptoms = entity.Symptoms, Conditions = entity.Conditions, ModifiedOn = entity.ModifiedOn }; return(model); }
public void UpdateHPIDetail_Failure() { //Arrange const string url = baseRoute + "UpdateHPIDetail"; var param = new NameValueCollection(); var srModel = new PresentIllnessDetailModel { HPIDetailID = -57, HPIID = 1, Comment = "Some reasonable comment", Location = "SOme different location", Quality = "SOme QUality Updated.", HPISeverityID = 1, Duration = " Some duration", Timing = "Some timing", Context = "Some context", EncounterID = null, TakenBy = 1, TakenTime = DateTime.Now, ForceRollback = true }; //Act var response = _communicationManager.Put <PresentIllnessDetailModel, Response <PresentIllnessDetailModel> >(srModel, url); // Assert Assert.IsNotNull(response, "Response can not be null"); Assert.IsTrue(response.RowAffected == 0, "HPI details updated for invalid record."); }
public Response <PresentIllnessDetailModel> UpdateHPIDetail(PresentIllnessDetailModel hpi) { var hpiRepository = _unitOfWork.GetRepository <PresentIllnessDetailModel>(SchemaName.Clinical); SqlParameter HPIXMLParam = new SqlParameter("HPIXML", GenerateRequestXml(hpi)); HPIXMLParam.DbType = DbType.Xml; SqlParameter modifiedOnParam = new SqlParameter("ModifiedOn", hpi.ModifiedOn ?? DateTime.Now); List <SqlParameter> procParams = new List <SqlParameter>() { HPIXMLParam, modifiedOnParam }; var hpiResult = _unitOfWork.EnsureInTransaction <Response <PresentIllnessDetailModel> >(hpiRepository.ExecuteNQStoredProc, "usp_UpdateHPIDetail", procParams); return(hpiResult); }
private string GenerateRequestXml(PresentIllnessDetailModel hpi) { using (StringWriter sWriter = new StringWriter()) { XmlWriterSettings settings = new XmlWriterSettings(); settings.OmitXmlDeclaration = true; using (XmlWriter XWriter = XmlWriter.Create(sWriter)) { XWriter.WriteStartElement("HPI"); XWriter.WriteStartElement("HPIDetails"); XWriter.WriteElementString("HPIID", hpi.HPIID.ToString()); XWriter.WriteElementString("HPIDetailID", hpi.HPIDetailID.ToString()); XWriter.WriteElementString("Comment", hpi.Comment); XWriter.WriteElementString("Location", hpi.Location); if (hpi.HPISeverityID.HasValue) { XWriter.WriteElementString("HPISeverityID", hpi.HPISeverityID.ToString()); } XWriter.WriteElementString("Quality", hpi.Quality); XWriter.WriteElementString("Duration", hpi.Duration); XWriter.WriteElementString("Timing", hpi.Timing); XWriter.WriteElementString("Context", hpi.Context); XWriter.WriteElementString("ModifyingFactors", hpi.Modifyingfactors); XWriter.WriteElementString("Conditions", hpi.Conditions); XWriter.WriteElementString("Symptoms", hpi.Symptoms); XWriter.WriteEndElement(); //HPIDetails XWriter.WriteEndElement(); //HPI } return(sWriter.ToString()); } }
public Response <PresentIllnessDetailModel> AddHPIDetail(PresentIllnessDetailModel HPI) { var apiUrl = BaseRoute + "AddHPIDetail"; return(_communicationManager.Post <PresentIllnessDetailModel, Response <PresentIllnessDetailModel> >(HPI, apiUrl)); }
public IHttpActionResult UpdateHPIDetail(PresentIllnessDetailModel HPI) { return(new HttpResult <Response <PresentIllnessDetailModel> >(_PresentIllnessRuleEngine.UpdateHPIDetail(HPI), Request)); }
public Response <PresentIllnessDetailModel> UpdateHPIDetail(PresentIllnessDetailModel HPI) { return(_PresentIllnessService.UpdateHPIDetail(HPI)); }
public IHttpActionResult UpdateHPIDetail(PresentIllnessDetailModel hpi) { var HPIResponse = _PresentIllnessDataProvider.UpdateHPIDetail(hpi); return(new HttpResult <Response <PresentIllnessDetailModel> >(HPIResponse, Request)); }
public IHttpActionResult AddHPIDetail(PresentIllnessDetailModel HPI) { var HPIResponse = _PresentIllnessDataProvider.AddHPIDetail(HPI); return(new HttpResult <Response <PresentIllnessDetailModel> >(HPIResponse, Request)); }