public async Task GivenStoredInstances_WhenRetrieveRequestForSeries_ThenInstancesInSeriesAreRetrievedSuccesfully()
        {
            var datasets = new List <DicomDataset>();

            datasets.AddRange(await GenerateDicomDatasets(_firstSeriesInstanceUid, 2, true));
            datasets.AddRange(await GenerateDicomDatasets(_secondSeriesInstanceUid, 1, true));

            RetrieveResourceResponse response = await _retrieveResourceService.GetInstanceResourceAsync(
                new RetrieveResourceRequest(_studyInstanceUid, _firstSeriesInstanceUid, new[] { AcceptHeaderHelpers.CreateAcceptHeaderForGetSeries() }),
                CancellationToken.None);

            ValidateResponseDicomFiles(response.ResponseStreams, datasets.Select(ds => ds).Where(ds => ds.ToInstanceIdentifier().SeriesInstanceUid == _firstSeriesInstanceUid));
        }
 public async Task GivenNoStoredInstances_WhenRetrieveRequestForSeries_ThenNotFoundIsThrown()
 {
     await Assert.ThrowsAsync <InstanceNotFoundException>(() => _retrieveResourceService.GetInstanceResourceAsync(
                                                              new RetrieveResourceRequest(_studyInstanceUid, _firstSeriesInstanceUid, new[] { AcceptHeaderHelpers.CreateAcceptHeaderForGetSeries() }),
                                                              CancellationToken.None));
 }
        public async Task GivenStoredInstancesWithMissingFile_WhenRetrieveRequestForSeries_ThenNotFoundIsThrown()
        {
            await GenerateDicomDatasets(_firstSeriesInstanceUid, 2, true);
            await GenerateDicomDatasets(_firstSeriesInstanceUid, 1, false);
            await GenerateDicomDatasets(_secondSeriesInstanceUid, 1, true);

            await Assert.ThrowsAsync <ItemNotFoundException>(() => _retrieveResourceService.GetInstanceResourceAsync(
                                                                 new RetrieveResourceRequest(_studyInstanceUid, _firstSeriesInstanceUid, new[] { AcceptHeaderHelpers.CreateAcceptHeaderForGetSeries() }),
                                                                 CancellationToken.None));
        }