public void TestDeleteBooks() { //Arrange BookDao bookDao = new BookDao(); String bookId = "1"; //Act Boolean result = bookDao.DeleteBookById(bookId); //Assert Assert.AreEqual(false, result); }
// 删除图书 protected void BtnDeleteBook_Click(object sender, EventArgs e) { int id = Convert.ToInt32(BookId.Text); //实例化一个bookDao BookDao bookDao = new BookDao(); //调用删除方法删除图书 if (bookDao.DeleteBookById(id)) { //刷新当前页 0为立即刷新 Response.AddHeader("Refresh", "0"); } }