public async Task GivenAChangeFeedWithNewSeriesAndInstanceForAnExistingImagingStudy_WhenBuilt_ThenCorrectEntryComponentShouldBeCreated()
        {
            const string studyInstanceUid     = "1";
            const string seriesInstanceUid    = "2";
            const string sopInstanceUid       = "3";
            const string patientResourceId    = "p1";
            const string newSeriesInstanceUid = "3";
            const string newSopInstanceUid    = "4";

            ImagingStudy imagingStudy = FhirResourceBuilder.CreateNewImagingStudy(studyInstanceUid, new List <string>()
            {
                seriesInstanceUid
            }, new List <string>()
            {
                sopInstanceUid
            }, patientResourceId);

            _fhirService.RetrieveImagingStudyAsync(Arg.Any <Identifier>(), Arg.Any <CancellationToken>()).Returns(imagingStudy);

            // Update an existing ImagingStudy
            FhirTransactionRequestEntry entry = await BuildImagingStudyEntryComponent(studyInstanceUid, newSeriesInstanceUid, newSopInstanceUid, patientResourceId);

            ImagingStudy updatedImagingStudy = ValidationUtility.ValidateImagingStudyUpdate(studyInstanceUid, patientResourceId, entry);

            Assert.Collection(
                updatedImagingStudy.Series,
                series =>
            {
                ValidationUtility.ValidateSeries(series, seriesInstanceUid, sopInstanceUid);
            },
                series =>
            {
                ValidationUtility.ValidateSeries(series, newSeriesInstanceUid, newSopInstanceUid);
            });
        }
        public async Task GivenAChangeFeedEntryToDeleteAnInstanceWithinAStudyContainingMoreThanOneSeries_WhenBuilt_ThenCorrectEntryComponentShouldBeCreated()
        {
            const string studyInstanceUid   = "1";
            const string seriesInstanceUid  = "2";
            const string seriesInstanceUid1 = "3";
            const string sopInstanceUid     = "3";
            const string patientResourceId  = "p1";

            // create a new ImagingStudy
            ImagingStudy imagingStudy = FhirResourceBuilder.CreateNewImagingStudy(studyInstanceUid, new List <string>()
            {
                seriesInstanceUid, seriesInstanceUid1
            }, new List <string>()
            {
                sopInstanceUid,
            }, patientResourceId);

            _fhirService.RetrieveImagingStudyAsync(Arg.Any <Identifier>(), Arg.Any <CancellationToken>()).Returns(imagingStudy);

            // delete an existing instance within a study
            FhirTransactionRequestEntry entry = await BuildImagingStudyEntryComponent(studyInstanceUid, seriesInstanceUid, sopInstanceUid, patientResourceId);

            ImagingStudy updatedImagingStudy = ValidationUtility.ValidateImagingStudyUpdate(studyInstanceUid, patientResourceId, entry);

            Assert.Equal(ImagingStudy.ImagingStudyStatus.Available, updatedImagingStudy.Status);

            Assert.Collection(
                updatedImagingStudy.Series,
                series =>
            {
                ValidationUtility.ValidateSeries(series, seriesInstanceUid1, sopInstanceUid);
            });
        }