示例#1
0
        public async void ValidateConditionalUpdate_Invalid_BadResourceType()
        {
            var service = new NrlsMaintain(_nrlsApiSettings, _fhirMaintain, _fhirSearch, _cache, _fhirValidation);

            var request = FhirRequests.Valid_Update;

            request.Resource = new Patient();

            var response = await service.ValidateConditionalUpdate(request);

            Assert.IsType <OperationOutcome>(response);

            var outcome = response as OperationOutcome;

            Assert.NotNull(outcome.Issue);
            Assert.NotEmpty(outcome.Issue);

            var details = outcome.Issue.FirstOrDefault().Details;

            Assert.NotNull(details);
            Assert.NotNull(details.Coding);
            Assert.NotEmpty(details.Coding);

            var errorDetail = details.Coding.FirstOrDefault();

            Assert.Equal("INVALID_RESOURCE", errorDetail.Code);
        }
示例#2
0
        public async void ValidateConditionalUpdate_Invalid_ReferenceMisMatchIdentifier()
        {
            var service = new NrlsMaintain(_nrlsApiSettings, _fhirMaintain, _fhirSearch, _sdsService, _fhirValidation);

            var response = await service.ValidateConditionalUpdate(FhirRequests.Invalid_Update_RelatesToInvalidRelatedIdentifier);

            Assert.IsType <OperationOutcome>(response);

            var outcome = response as OperationOutcome;

            Assert.NotNull(outcome.Issue);
            Assert.NotEmpty(outcome.Issue);

            var issue = outcome.Issue.FirstOrDefault();

            Assert.Equal("Resolved DocumentReference does not have a matching MasterIdentifier.", issue.Diagnostics);

            var details = issue.Details;

            Assert.NotNull(details);
            Assert.NotNull(details.Coding);
            Assert.NotEmpty(details.Coding);

            var errorDetail = details.Coding.FirstOrDefault();

            Assert.Equal("INVALID_RESOURCE", errorDetail.Code);
        }
示例#3
0
        public async void ValidateConditionalUpdate_Invalid_PatientMismatch()
        {
            var service = new NrlsMaintain(_nrlsApiSettings, _fhirMaintain, _fhirSearch, _sdsService, _fhirValidation);

            var response = await service.ValidateConditionalUpdate(FhirRequests.Invalid_Update_PatientMismatch);

            Assert.IsType <OperationOutcome>(response);

            var outcome = response as OperationOutcome;

            Assert.NotNull(outcome.Issue);
            Assert.NotEmpty(outcome.Issue);

            var issue = outcome.Issue.FirstOrDefault();

            Assert.Equal("Resolved DocumentReference is not associated with the same patient.", issue.Diagnostics);

            var details = issue.Details;

            Assert.NotNull(details);
            Assert.NotNull(details.Coding);
            Assert.NotEmpty(details.Coding);

            var errorDetail = details.Coding.FirstOrDefault();

            Assert.Equal("INVALID_RESOURCE", errorDetail.Code);
        }
示例#4
0
        public async void ValidateConditionalUpdate_Valid_NoRelatesTo()
        {
            var service = new NrlsMaintain(_nrlsApiSettings, _fhirMaintain, _fhirSearch, _cache, _fhirValidation);

            var response = await service.ValidateConditionalUpdate(FhirRequests.Valid_Create);

            Assert.Null(response);
        }
示例#5
0
        public async void ValidateConditionalUpdate_Valid()
        {
            var service = new NrlsMaintain(_nrlsApiSettings, _fhirMaintain, _fhirSearch, _cache, _fhirValidation);

            var response = await service.ValidateConditionalUpdate(FhirRequests.Valid_Update);

            Assert.IsType <DocumentReference>(response);
        }
示例#6
0
        public async void ValidateConditionalUpdate_Invalid_Status()
        {
            var service = new NrlsMaintain(_nrlsApiSettings, _fhirMaintain, _fhirSearch, _sdsService, _fhirValidation);

            var response = await service.ValidateConditionalUpdate(FhirRequests.Invalid_Update_Bad_Status);

            Assert.IsType <OperationOutcome>(response);

            var outcome = response as OperationOutcome;

            Assert.NotNull(outcome.Issue);
            Assert.NotEmpty(outcome.Issue);

            var details = outcome.Issue.FirstOrDefault().Details;

            Assert.NotNull(details);
            Assert.NotNull(details.Coding);
            Assert.NotEmpty(details.Coding);

            var errorDetail = details.Coding.FirstOrDefault();

            Assert.Equal("BAD_REQUEST", errorDetail.Code);
        }