public void should_Save_Or_Update_Obs_New() { var newObs = _obs; newObs.Id = LiveGuid.NewGuid(); _obsRepository.SaveOrUpdate(newObs); _obsRepository = new ObsRepository(_liveSetting); var savedNewObs = _obsRepository.Get(newObs.Id); Assert.AreEqual(newObs.Id, savedNewObs.Id); Assert.IsNotNull(savedNewObs); }
public void SaveResponse(Guid encounterId, Guid clientId, Guid questionId, object response, bool validated = false) { var liveResponse = new Response(encounterId, clientId); var question = _manifest.GetQuestion(questionId); liveResponse.SetQuestion(question); liveResponse.SetObs(encounterId, clientId, questionId, question.Concept.ConceptTypeId, response); if (validated) { if (_validationEngine.Validate(liveResponse)) { _obsRepository.SaveOrUpdate(liveResponse.Obs); UpdateManifest(encounterId); } } else { _obsRepository.SaveOrUpdate(liveResponse.Obs); UpdateManifest(encounterId); } // check consent if (questionId == new Guid("b2603dc6-852f-11e7-bb31-be2e44b06b34")) { // if (null != liveResponse.Obs.ValueCoded && liveResponse.Obs.ValueCoded.Value == new Guid("b25eccd4-852f-11e7-bb31-be2e44b06b34")) { _clientStateRepository.SaveOrUpdate(new ClientState(clientId, encounterId, LiveState.HtsConsented)); } else { _clientStateRepository.DeleteState(clientId, encounterId, LiveState.HtsConsented); } } // // }