Example #1
0
        public void should_Get_Testing_By_Client()
        {
            var encounters = _clientRepository.GetTesting(_clientId).ToList();

            Assert.True(encounters.Any());
            var details = encounters.SelectMany(x => x.ObsTestResults).ToList();

            Assert.True(details.Any());
        }
        public async Task <IEnumerable <ClientTestingStage> > Extract(Guid?htsClientId = null)
        {
            var subscriber = await _subscriberSystemRepository.GetDefaultAsync();

            if (null == subscriber)
            {
                throw new Exception("Default EMR NOT SET");
            }
            var clients = new List <ClientTestingStage>();

            var encounters = _clientEncounterRepository.GetTesting(htsClientId);

            foreach (var encounter in encounters)
            {
                var pretestId =
                    _clientEncounterRepository.GetPretestEncounterId(encounter.ClientId, encounter.EncounterDate);
                clients.AddRange(ClientTestingStage.Create(encounter, subscriber, pretestId));
            }

            return(clients.Where(x => !x.Id.IsNullOrEmpty()));
        }