public void UpdateStatus_BadBodyOrQuery()
        {
            var controller = new NrlsController(_nrlsSettings, _nrlsSearch, _nrlsMaintain);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = HttpContexts.InvalidQuery_Update_Pointer;

            var response = controller.Patch(new Parameters());

            Assert.True(response.IsFaulted);

            Assert.NotNull(response.Exception);

            Assert.NotNull(response.Exception.InnerException);

            Assert.Equal(typeof(HttpFhirException), response.Exception.InnerException.GetType());

            Assert.NotNull((response.Exception.InnerException as HttpFhirException).OperationOutcome);
        }
        public async void UpdateStatus_Valid()
        {
            var controller = new NrlsController(_nrlsSettings, _nrlsSearch, _nrlsMaintain);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = HttpContexts.Valid_Update_Pointer;

            var response = await controller.Patch(new Parameters(), "logicalId");

            Assert.IsType <OkObjectResult>(response);

            var okResult = response as OkObjectResult;

            Assert.Equal(200, okResult.StatusCode);

            var responseContent = okResult.Value;

            Assert.IsType <OperationOutcome>(responseContent);
            var operationOutcome = responseContent as OperationOutcome;

            Assert.True(operationOutcome.Success);
        }
        public async void UpdateStatus_NotFound()
        {
            var controller = new NrlsController(_nrlsSettings, _nrlsSearch, _nrlsMaintain);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = HttpContexts.Invalid_Delete_Pointer_NotFound;

            var response = await controller.Patch(new Parameters());

            Assert.IsType <NotFoundObjectResult>(response);

            var notfoundResult = response as NotFoundObjectResult;

            Assert.Equal(404, notfoundResult.StatusCode);

            var responseContent = notfoundResult.Value;

            Assert.IsType <OperationOutcome>(responseContent);
            var operationOutcome = responseContent as OperationOutcome;

            Assert.False(operationOutcome.Success);

            Assert.NotNull(operationOutcome.Issue.FirstOrDefault(x => x.Details.Coding.FirstOrDefault(y => y.Code == "NO_RECORD_FOUND") != null));
        }
        public async void UpdateStatus_Invalid()
        {
            var controller = new NrlsController(_nrlsSettings, _nrlsSearch, _nrlsMaintain);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = HttpContexts.Invalid_Delete_Pointer_BadRequest;

            var response = await controller.Patch(new Parameters());

            Assert.IsType <BadRequestObjectResult>(response);

            var badResult = response as BadRequestObjectResult;

            Assert.Equal(400, badResult.StatusCode);

            var responseContent = badResult.Value;

            Assert.IsType <OperationOutcome>(responseContent);
            var operationOutcome = responseContent as OperationOutcome;

            Assert.False(operationOutcome.Success);

            Assert.NotNull(operationOutcome.Issue.FirstOrDefault(x => x.Details.Coding.FirstOrDefault(y => y.Code == "INVALID_RESOURCE") != null));
        }