Beispiel #1
0
        public void Test_getting_a_bad_request_for_empty_name()
        {
            var controller = new ValuesController();
            var result     = controller.GetByName("");

            Assert.IsInstanceOfType(result, typeof(BadRequestResult));  //NOTE: this only bad result!!
        }
Beispiel #2
0
        public void GetByName_ReturnsBadRequest()
        {
            // arrange
            var controller = new ValuesController(_valueService)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = _contextMock.Object
                }
            };

            // act
            var result = controller.GetByName("name");

            // assert
            Assert.IsInstanceOfType(result, typeof(BadRequestResult));
            Assert.IsTrue(controller.Response.Headers["x-status-reason"].ToString() == "The value 'name' is not recognised as a valid integer to uniquely identify a resource.");
        }