public void GivenATransactionContextAndImagingStudyWithNewEndpointReference_WhenProcessedForStudyWithEndpoint_ThenEndpointIsAdded() { ImagingStudy imagingStudy = FhirResourceBuilder.CreateNewImagingStudy(DefaultStudyInstanceUid, new List <string>() { DefaultSeriesInstanceUid }, new List <string>() { DefaultSopInstanceUid }, DefaultPatientResourceId); // Simulate the imaging study with an existing endpoint. Endpoint existingEndpoint = FhirResourceBuilder.CreateEndpointResource(id: "2345", name: "new wado-rs"); var existingEndpointResourceId = new ServerResourceId(ResourceType.Endpoint, existingEndpoint.Id); var existingEndpointReference = existingEndpointResourceId.ToResourceReference(); imagingStudy.Endpoint.Add(existingEndpointReference); Endpoint endpoint = FhirResourceBuilder.CreateEndpointResource(); var endpointResourceId = new ServerResourceId(ResourceType.Endpoint, endpoint.Id); var endpointReference = endpointResourceId.ToResourceReference(); FhirTransactionContext context = FhirTransactionContextBuilder.DefaultFhirTransactionContext(FhirTransactionContextBuilder.CreateDicomDataset()); context.Request.Endpoint = FhirTransactionRequestEntryGenerator.GenerateDefaultNoChangeRequestEntry <Endpoint>(endpointResourceId); _imagingStudyPropertySynchronizer.Synchronize(context, imagingStudy); Assert.Collection( imagingStudy.Endpoint, endPoint => Assert.Equal(existingEndpointReference, endPoint), endPoint => Assert.Equal(endpointReference, endPoint)); }
public void GivenAServerResourceId_WhenConvertedToResourceReference_ThenCorrectResourceReferenceShouldBeCreated() { ResourceReference resourceReference = ServerResourceId.ToResourceReference(); Assert.NotNull(resourceReference); Assert.Equal(ResourceReference, resourceReference.Reference); }
public async Task GivenATransactionContextAndImagingStudyWithExistingEndpointReference_WhenProcessedForStudy_ThenEndpointResourceIsNotAddedAsync() { ImagingStudy imagingStudy = FhirResourceBuilder.CreateNewImagingStudy(DefaultStudyInstanceUid, new List <string>() { DefaultSeriesInstanceUid }, new List <string>() { DefaultSopInstanceUid }, DefaultPatientResourceId); Endpoint endpoint = FhirResourceBuilder.CreateEndpointResource(); var endpointResourceId = new ServerResourceId(ResourceType.Endpoint, endpoint.Id); var endpointReference = endpointResourceId.ToResourceReference(); FhirTransactionContext context = FhirTransactionContextBuilder.DefaultFhirTransactionContext(FhirTransactionContextBuilder.CreateDicomDataset()); context.Request.Endpoint = FhirTransactionRequestEntryGenerator.GenerateDefaultNoChangeRequestEntry <Endpoint>(endpointResourceId); imagingStudy.Endpoint.Add(endpointReference); await _imagingStudyPropertySynchronizer.SynchronizeAsync(context, imagingStudy); Assert.Collection( imagingStudy.Endpoint, endPoint => Assert.Equal(endpointReference, endPoint)); }