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

            var response = await service.SupersedeWithoutValidation <DocumentReference>(FhirRequests.Valid_Create, "5ab13f41957d0ad5d93a1339", "1");

            Assert.IsType <DocumentReference>(response);
        }
Beispiel #2
0
        public async void Supersede_Invalid_Update()
        {
            var service = new NrlsMaintain(_nrlsApiSettings, _fhirMaintain, _fhirSearch, _cache, _fhirValidation);

            var response = await service.SupersedeWithoutValidation <DocumentReference>(FhirRequests.Valid_Create, "5ab13f41957d0ad5d93a1337", "1");

            Assert.IsType <OperationOutcome>(response);

            var outcome = response as OperationOutcome;

            Assert.False(outcome.Success);

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

            var issue = outcome.Issue.FirstOrDefault();

            Assert.Equal("Resource is invalid : relatesTo", issue.Diagnostics);
        }
Beispiel #3
0
        public async void Supersede_Fatal_ThrowsException()
        {
            var service = new NrlsMaintain(_nrlsApiSettings, _fhirMaintain, _fhirSearch, _cache, _fhirValidation);

            var exception = await Assert.ThrowsAsync <HttpFhirException>(async delegate
            {
                var response = await service.SupersedeWithoutValidation <DocumentReference>(FhirRequests.Valid_Create, "5ab13f41957d0ad5d93a1336", "1");
            });

            Assert.Equal("Error Updating DocumentReference", exception.Message);

            Assert.NotNull(exception.OperationOutcome);

            var outcome = exception.OperationOutcome;

            Assert.False(outcome.Success);

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

            var issue = outcome.Issue.FirstOrDefault();

            Assert.StartsWith("There has been an internal error when attempting to persist the DocumentReference. Please contact the national helpdesk quoting -", issue.Diagnostics);
        }