public async Task GivenRetrieveStudyMetadataRequest_WhenIfNoneMatchMatchesETag_ThenNotModifiedResponseIsReturned()
        {
            string studyInstanceUid = TestUidGenerator.Generate();

            DicomDataset storedInstance = await PostDicomFileAsync(ResourceType.Study, studyInstanceUid, dataSet : GenerateNewDataSet());

            DicomWebResponse <IReadOnlyList <DicomDataset> > response = await _client.RetrieveStudyMetadataAsync(studyInstanceUid);

            string eTag = GetEtagFromResponse(response);

            response = await _client.RetrieveStudyMetadataAsync(studyInstanceUid, eTag);

            Assert.Equal(HttpStatusCode.NotModified, response.StatusCode);
            Assert.Null(response.Value);    // Make sure that the body is null.
        }
Пример #2
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;
        }
        public async Task GivenRetrieveStudyMetadataRequest_WhenStudyInstanceUidDoesnotExists_ThenNotFoundIsReturned()
        {
            DicomWebException exception = await Assert.ThrowsAsync <DicomWebException>(() => _client.RetrieveStudyMetadataAsync(TestUidGenerator.Generate()));

            Assert.Equal(HttpStatusCode.NotFound, exception.StatusCode);
        }