public async void Delete_Valid() { var controller = new NrlsController(_nrlsSettings, _nrlsSearch, _nrlsMaintain); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = HttpContexts.Valid_Delete_Pointer; var response = await controller.Delete(); 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 Delete_NotFound() { var controller = new NrlsController(_nrlsSettings, _nrlsSearch, _nrlsMaintain); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = HttpContexts.Invalid_Delete_Pointer_NotFound; var response = await controller.Delete(); 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 Delete_Invalid() { var controller = new NrlsController(_nrlsSettings, _nrlsSearch, _nrlsMaintain); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = HttpContexts.Invalid_Delete_Pointer_BadRequest; var response = await controller.Delete(); 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)); }