public async Task GivenRetrieveInstanceMetadataRequest_WhenIfNoneMatchMatchesETag_ThenNotModifiedResponseIsReturned()
        {
            string studyInstanceUid  = TestUidGenerator.Generate();
            string seriesInstanceUid = TestUidGenerator.Generate();
            string sopInstanceUid    = TestUidGenerator.Generate();

            DicomDataset storedInstance = await PostDicomFileAsync(ResourceType.Instance, studyInstanceUid, seriesInstanceUid, sopInstanceUid, dataSet : GenerateNewDataSet());

            DicomWebResponse <IReadOnlyList <DicomDataset> > response = await _client.RetrieveInstanceMetadataAsync(studyInstanceUid, seriesInstanceUid, sopInstanceUid);

            string eTag = GetEtagFromResponse(response);

            response = await _client.RetrieveInstanceMetadataAsync(studyInstanceUid, seriesInstanceUid, sopInstanceUid, eTag);

            Assert.Equal(HttpStatusCode.NotModified, response.StatusCode);
            Assert.Null(response.Value);    // Make sure that the body is null.
        }
        public async Task GivenRetrieveSopInstanceMetadataRequest_WhenSopInstanceUidDoesnotExists_ThenNotFoundIsReturned()
        {
            string studyInstanceUid  = TestUidGenerator.Generate();
            string seriesInstanceUid = TestUidGenerator.Generate();

            await PostDicomFileAsync(ResourceType.Instance, studyInstanceUid, seriesInstanceUid, TestUidGenerator.Generate());

            DicomWebException exception = await Assert.ThrowsAsync <DicomWebException>(() => _client.RetrieveInstanceMetadataAsync(studyInstanceUid, seriesInstanceUid, TestUidGenerator.Generate()));

            Assert.Equal(HttpStatusCode.NotFound, exception.StatusCode);
        }
Ejemplo n.º 3
0
        private static async Task WadoMetadata(Message message, CancellationToken token)
        {
            (string studyInstanceUid, string seriesInstanceUid, string sopInstanceUid) = ParseMessageForUids(message);

            if (sopInstanceUid != null)
            {
                await client.RetrieveInstanceMetadataAsync(studyInstanceUid, seriesInstanceUid, sopInstanceUid, cancellationToken : token);
            }
            else if (seriesInstanceUid != null)
            {
                await client.RetrieveSeriesMetadataAsync(studyInstanceUid, seriesInstanceUid, cancellationToken : token);
            }
            else
            {
                await client.RetrieveStudyMetadataAsync(studyInstanceUid, cancellationToken : token);
            }

            return;
        }