public async Task <GetExtendedQueryTagErrorsResponse> Handle(GetExtendedQueryTagErrorsRequest request, CancellationToken cancellationToken)
        {
            EnsureArg.IsNotNull(request, nameof(request));

            if (await AuthorizationService.CheckAccess(DataActions.Read, cancellationToken) != DataActions.Read)
            {
                throw new UnauthorizedDicomActionException(DataActions.Read);
            }

            return(await _getExtendedQueryTagErrorsService.GetExtendedQueryTagErrorsAsync(request.Path, request.Limit, request.Offset, cancellationToken));
        }
Beispiel #2
0
        public async Task GivenRequestForExtendedQueryTagError_WhenTagDoesNotExist_ThenReturnEmptyList()
        {
            string tagPath = DicomTag.DeviceID.GetPath();

            DicomTag[] parsedTags = new DicomTag[] { DicomTag.DeviceID };

            _dicomTagParser.TryParse(tagPath, out Arg.Any <DicomTag[]>()).Returns(x =>
            {
                x[1] = parsedTags;
                return(true);
            });

            _extendedQueryTagErrorStore.GetExtendedQueryTagErrorsAsync(tagPath, 100, 200).Returns(Array.Empty <ExtendedQueryTagError>());
            GetExtendedQueryTagErrorsResponse response = await _extendedQueryTagErrorsService.GetExtendedQueryTagErrorsAsync(tagPath, 100, 200);

            _dicomTagParser.Received(1).TryParse(
                Arg.Is(tagPath),
                out Arg.Any <DicomTag[]>());
            await _extendedQueryTagErrorStore.Received(1).GetExtendedQueryTagErrorsAsync(tagPath, 100, 200);

            Assert.Empty(response.ExtendedQueryTagErrors);
        }