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

            var response = await service.CreateWithoutValidation <DocumentReference>(FhirRequests.Valid_Create);

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

            var response = await service.CreateWithoutValidation <DocumentReference>(FhirRequests.Invalid_Custodian);

            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);
        }