public async void ValidOrg_ReturnsNotFound() { var controller = new ActorOrganisationsController(_actorOrganisationService); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = HttpContexts.Valid_Search; var response = await controller.GetOne("5a82f9ffcb969daa58d33378"); Assert.IsType <NotFoundObjectResult>(response); var notFoundResult = response as NotFoundObjectResult; Assert.Equal(404, notFoundResult.StatusCode); }
public async void ValidOrg_ReturnsOk() { var controller = new ActorOrganisationsController(_actorOrganisationService); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = HttpContexts.Valid_Search; var response = await controller.GetOne("5a82f9ffcb969daa58d33377"); Assert.IsType <OkObjectResult>(response); var okResult = response as OkObjectResult; Assert.Equal(200, okResult.StatusCode); var responseContent = okResult.Value; Assert.IsType <ActorOrganisationViewModel>(responseContent); var viewModel = responseContent as ActorOrganisationViewModel; Assert.Equal("Ambulance Service", viewModel.Name); Assert.Equal("AMSR01", viewModel.OrgCode); }