public async Task GivenRetrieveStudyMetadataRequest_WhenInstanceIsDeletedInStudyAndPreviousETagIsUsed_ThenResponseMetadataIsReturnedWithNewETag() { string studyInstanceUid = TestUidGenerator.Generate(); string firstSeriesInstanceUid = TestUidGenerator.Generate(); string firstSopInstanceUid = TestUidGenerator.Generate(); DicomDataset firstStoredInstance = await PostDicomFileAsync(ResourceType.Instance, studyInstanceUid, firstSeriesInstanceUid, firstSopInstanceUid, dataSet : GenerateNewDataSet()); DicomDataset secondStoredInstance = await PostDicomFileAsync(ResourceType.Study, studyInstanceUid, dataSet : GenerateNewDataSet()); DicomWebResponse <IReadOnlyList <DicomDataset> > response = await _client.RetrieveStudyMetadataAsync(studyInstanceUid); string eTag = GetEtagFromResponse(response); await _client.DeleteInstanceAsync(studyInstanceUid, firstSeriesInstanceUid, firstSopInstanceUid); response = await _client.RetrieveStudyMetadataAsync(studyInstanceUid, eTag); Assert.Single(response.Value); ValidateResponseMetadataDataset(secondStoredInstance, response.Value.First()); }
public async Task GivenADeletedAndReplacedInstance_WhenRetrievingChangeFeed_ThenTheExpectedInstanceAreReturned() { var studyInstanceUid = TestUidGenerator.Generate(); var seriesInstanceUid = TestUidGenerator.Generate(); var sopInstanceUid = TestUidGenerator.Generate(); await CreateFile(studyInstanceUid, seriesInstanceUid, sopInstanceUid); var latestResult = await _client.GetChangeFeedLatest(); long initialSequence = latestResult.Value.Sequence; ValidateFeed(ChangeFeedAction.Create, ChangeFeedState.Current); await _client.DeleteInstanceAsync(studyInstanceUid, seriesInstanceUid, sopInstanceUid); latestResult = await _client.GetChangeFeedLatest(); ValidateFeed(ChangeFeedAction.Delete, ChangeFeedState.Deleted); await CreateFile(studyInstanceUid, seriesInstanceUid, sopInstanceUid); latestResult = await _client.GetChangeFeedLatest(); ValidateFeed(ChangeFeedAction.Create, ChangeFeedState.Current); var changeFeedResults = await _client.GetChangeFeed($"?offset={initialSequence - 1}"); Assert.Equal(3, changeFeedResults.Value.Count); Assert.Equal(ChangeFeedState.Replaced, changeFeedResults.Value[0].State); Assert.Equal(ChangeFeedState.Replaced, changeFeedResults.Value[1].State); Assert.Equal(ChangeFeedState.Current, changeFeedResults.Value[2].State); void ValidateFeed(ChangeFeedAction action, ChangeFeedState state) { Assert.Equal(studyInstanceUid, latestResult.Value.StudyInstanceUid); Assert.Equal(seriesInstanceUid, latestResult.Value.SeriesInstanceUid); Assert.Equal(sopInstanceUid, latestResult.Value.SopInstanceUid); Assert.Equal(action, latestResult.Value.Action); Assert.Equal(state, latestResult.Value.State); if (state == ChangeFeedState.Deleted) { Assert.Null(latestResult.Value.Metadata); } else { Assert.NotNull(latestResult.Value.Metadata); } } }
public async Task GivenAnExistingInstance_WhenDeletingInstance_TheServerShouldReturnNoContentAndAllLevelsShouldBeRemoved() { var studyInstanceUid = TestUidGenerator.Generate(); var seriesInstanceUid = TestUidGenerator.Generate(); var sopInstanceUid = TestUidGenerator.Generate(); await CreateFile(studyInstanceUid, seriesInstanceUid, sopInstanceUid); DicomWebResponse response = await _client.DeleteInstanceAsync(studyInstanceUid, seriesInstanceUid, sopInstanceUid); Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); await VerifyAllRemoval(studyInstanceUid, seriesInstanceUid, sopInstanceUid); }