示例#1
0
        public async void Valid_ReturnsNotFound()
        {
            var controller = new NrlsController(_pointerService);

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

            var response = await controller.Document("anything", "0000000001");

            Assert.IsType <NotFoundResult>(response);

            var notFoundResult = response as NotFoundResult;

            Assert.Equal(404, notFoundResult.StatusCode);
        }
示例#2
0
        public async void Valid_ReturnsOk()
        {
            var controller = new NrlsController(_pointerService);

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

            var response = await controller.Document("anything", "0000000000");

            Assert.IsType <OkObjectResult>(response);

            var okResult = response as OkObjectResult;

            Assert.Equal(200, okResult.StatusCode);

            var responseContent = okResult.Value;

            Assert.IsType <Binary>(responseContent);
            var binary = responseContent as Binary;

            Assert.Equal("text/html", binary.ContentType);
            Assert.Equal(Encoding.UTF8.GetBytes("<p>Hello</p>"), binary.Content);
        }