示例#1
0
        public async Task GivenAnExistingEndpointWithMatchingAddress_WhenRequestIsPrepared_ThenCorrectRequestEntryShouldBeCreated()
        {
            var context = new FhirTransactionContext(ChangeFeedGenerator.Generate());

            Endpoint endpoint = FhirResourceBuilder.CreateEndpointResource(address: DefaultDicomWebEndpoint);

            _fhirService.RetrieveEndpointAsync(Arg.Any <string>(), DefaultCancellationToken).Returns(endpoint);

            await _endpointPipeline.PrepareRequestAsync(context, DefaultCancellationToken);

            FhirTransactionRequestEntry actualEndPointEntry = context.Request.Endpoint;

            ValidationUtility.ValidateRequestEntryMinimumRequirementForNoChange(endpoint.ToServerResourceId(), actualEndPointEntry);
        }
        public async Task GivenExistingPatientAndNoChange_WhenRequestIsPrepared_ThenCorrectEntryComponentShouldBeCreated()
        {
            FhirTransactionContext context = CreateFhirTransactionContext();

            var patient = new Patient()
            {
                Id   = "patient1",
                Meta = new Meta()
                {
                    VersionId = "v1",
                },
            };

            _fhirService.RetrievePatientAsync(Arg.Is(TestUtility.BuildIdentifierPredicate(string.Empty, DefaultPatientId)), DefaultCancellationToken)
            .Returns(patient);

            await _patientPipeline.PrepareRequestAsync(context, DefaultCancellationToken);

            FhirTransactionRequestEntry actualPatientEntry = context.Request.Patient;

            ValidationUtility.ValidateRequestEntryMinimumRequirementForNoChange(patient.ToServerResourceId(), actualPatientEntry);
        }