Пример #1
0
 public void SetUp()
 {
     _loader    = TestInitializer.ServiceProvider.GetService <IMasterPatientIndexLoader>();
     _extractor = TestInitializer.ServiceProvider.GetService <IMasterPatientIndexSourceExtractor>();
     _extract   = _extracts.First(x => x.Name.IsSameAs(nameof(MasterPatientIndex)));
     _count     = _extractor.Extract(_extract, _protocol).Result;
 }
        public void should_Extract(string name)
        {
            Assert.False(_extractsContext.TempMasterPatientIndices.Any());
            var extract = _extracts.First(x => x.Name.IsSameAs(name));

            var count = _extractor.Extract(extract, _protocol).Result;

            Assert.True(count > 0);
            _extractsContext = TestInitializer.ServiceProvider.GetService <ExtractsContext>();
            Assert.AreEqual(count, _extractsContext.TempMasterPatientIndices.Count());
            Log.Debug($"extracted {_extractsContext.TempMasterPatientIndices.Count()}");
        }
Пример #3
0
        public async Task <bool> Handle(ExtractMasterPatientIndex request, CancellationToken cancellationToken)
        {
            //  clear
            await _clearExtracts.Clean(request.Extract.Id);

            //  extract
            int found = await _patientSourceExtractor.Extract(request.Extract, request.DatabaseProtocol);

            DomainEvents.Dispatch(new CbsNotification(new ExtractProgress(nameof(MasterPatientIndex), "validating...")));
            //  await _patientValidator.Validate();

            DomainEvents.Dispatch(new CbsNotification(new ExtractProgress(nameof(MasterPatientIndex), "loading...")));
            int loaded = await _patientLoader.Load(request.Extract.Id, 0);

            DomainEvents.Dispatch(new CbsNotification(new ExtractProgress(nameof(MasterPatientIndex), "loaded")));
            //notify loaded
            return(true);
        }