Exemplo n.º 1
0
        public async void Read_Invalid()
        {
            var controller = new OdsController(_odsSearch);

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

            var response = await controller.Read("notfound");

            Assert.IsType <NotFoundObjectResult>(response);

            var result = response as NotFoundObjectResult;

            Assert.Equal(404, result.StatusCode);

            var responseContent = result.Value;

            Assert.IsType <OperationOutcome>(responseContent);

            var outcome = responseContent as OperationOutcome;

            Assert.Single(outcome.Issue);

            Assert.Equal("NotFound", outcome.Issue.First().Code.Value.ToString());
        }
Exemplo n.º 2
0
        public async void Read_Valid()
        {
            var controller = new OdsController(_odsSearch);

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

            var response = await controller.Read("odscode");

            Assert.IsType <OkObjectResult>(response);

            var okResult = response as OkObjectResult;

            Assert.Equal(200, okResult.StatusCode);

            var responseContent = okResult.Value;

            Assert.IsType <Organization>(responseContent);

            var org = responseContent as Organization;

            Assert.Equal("5ab13695957d0ad5d93a1330", org.Id);
        }