public void should_GetLiveQuestion_First() { //Q1.Consent _obsService.Initialize(_encounterNew); var question = _obsService.GetLiveQuestion(); Assert.IsNotNull(question); Assert.AreEqual(1, question.Rank); Console.WriteLine(question); Assert.IsFalse(question.SkippedQuestionIds.Any()); Console.WriteLine($"skipped {question.SkippedQuestionIds.Count}"); }
public void LoadView() { //set defaults if (null != Manifest) { BirthDate = Manifest.Encounter.EncounterDate; SelectedVisitType = SetVisitType(Manifest.Encounter.VisitType); if (Manifest.HasResponses()) { // Load saved responses var responses = Manifest .ResponseStore .OrderBy(x => x.Question.Rank) .ToList(); if (null != responses && responses.Count > 0) { var r = responses.First(); var q = Questions.FirstOrDefault(x => x.QuestionTemplate.Id == r.QuestionId); if (null != q) { // determine if to Allow Response if (!q.QuestionTemplate.Allow) { q.QuestionTemplate.Allow = true; } // determine if to set Response var existingResponse = q.QuestionTemplate.GetResponse(); if (null == existingResponse || string.IsNullOrWhiteSpace(existingResponse.ToString())) { var readRespnse = r.GetValue().Value; q.QuestionTemplate.SetResponse(readRespnse); } } } } else { // Load active Questsion var activeQuestion = _obsService.GetLiveQuestion(Manifest); var liveQuestion = Questions.FirstOrDefault(x => x.QuestionTemplate.Id == activeQuestion.Id); if (null != liveQuestion) { if (!liveQuestion.QuestionTemplate.Allow) { liveQuestion.QuestionTemplate.Allow = true; } } } } SetDefualts(); }