Esempio n. 1
0
        public async Task WhenDoesNotEnforceAllFields_AndPropertyNotRequired_DoesNotThrowError()
        {
            _dicomCastConfig.Features.EnforceValidationOfTagValues = false;

            _propertySynchronizer.When(synchronizer => synchronizer.Synchronize(Arg.Any <DicomDataset>(), Arg.Any <Patient>(), isNewPatient: false)).Do(synchronizer => { throw new InvalidDicomTagValueException("invalid tag", "invalid tag"); });

            IEnumerable <IPatientPropertySynchronizer> patientPropertySynchronizers = new List <IPatientPropertySynchronizer>()
            {
                _propertySynchronizer,
            };

            PatientSynchronizer patientSynchronizer = new PatientSynchronizer(patientPropertySynchronizers, Options.Create(_dicomCastConfig), _exceptionStore);

            FhirTransactionContext context = new FhirTransactionContext(ChangeFeedGenerator.Generate(metadata: DefaultDicomDataset));
            var patient = new Patient();

            await patientSynchronizer.SynchronizeAsync(context, patient, false, DefaultCancellationToken);
        }
Esempio n. 2
0
        public async Task WhenPatialValidationDisabled_AndError_ThrowsError()
        {
            _dicomCastConfig.Features.IgnoreSyncOfInvalidTagValue = false;

            _propertySynchronizer.When(synchronizer => synchronizer.Synchronize(Arg.Any <DicomDataset>(), Arg.Any <Patient>(), isNewPatient: false)).Do(synchronizer => { throw new InvalidDicomTagValueException("invalid tag", "invalid tag"); });

            IEnumerable <IPatientPropertySynchronizer> patientPropertySynchronizers = new List <IPatientPropertySynchronizer>()
            {
                _propertySynchronizer,
            };

            PatientSynchronizer patientSynchronizer = new PatientSynchronizer(patientPropertySynchronizers, Options.Create(_dicomCastConfig), _exceptionStore);

            FhirTransactionContext context = new FhirTransactionContext(ChangeFeedGenerator.Generate(metadata: DefaultDicomDataset));
            var patient = new Patient();

            await Assert.ThrowsAsync <InvalidDicomTagValueException>(() => patientSynchronizer.SynchronizeAsync(context, patient, false, DefaultCancellationToken));
        }