コード例 #1
0
        public void ThemTienIch_TestStatusResponse()
        {
            var tien_ich      = data_test.TaoMoiTienIch();
            var action_result = controller.ThemTienIch(tien_ich);
            //act
            var actual_result1   = action_result as OkNegotiatedContentResult <string>;
            var actual_result2   = action_result as BadRequestErrorMessageResult;
            var expected_result1 = "Thêm tiện ích thành công!";
            var expected_result2 = "Thêm tiện ích thất bại!";

            //assert
            try
            {
                Assert.AreEqual(expected_result1, actual_result1.Content);
            }
            catch (System.Exception)
            {
                Assert.AreEqual(expected_result2, actual_result2.Message);
            }
        }