コード例 #1
0
        public void GetById_catch_exception()
        {
            FoodsController controller = GetController(throwException);
            var             result     = controller.GetById("id_test_food") as BadRequestObjectResult;
            var             message    = result.Value.GetType().Name;

            Assert.AreEqual(message, "Exception");
        }
コード例 #2
0
        public void GetById_return_food()
        {
            FoodsController controller = GetController(doNotThrowException);
            var             result     = controller.GetById("id_test_food") as OkObjectResult;
            FoodsResponse   response   = result.Value as FoodsResponse;

            Assert.IsNotNull(response.Foods[0]);
        }