protected void btnConfirm_Click(object sender, EventArgs e) { clsBookCollection ABook = new clsBookCollection(); ABook.ThisBook.Find(BookID); ABook.Delete(); Response.Redirect("BookList.aspx"); }
public void DeleteMethodOK() { clsBookCollection AllBooks = new clsBookCollection(); clsBook TestItem = new clsBook(); int PrimaryKey = 0; //TestItem.BookID = 1; TestItem.Title = "Oxford English Dictionary"; TestItem.DatePublished = Convert.ToDateTime("1/2/1884"); TestItem.Stock = 50; TestItem.Price = 4.99F; TestItem.AvailableOnline = false; AllBooks.ThisBook = TestItem; PrimaryKey = AllBooks.Add(); TestItem.BookID = PrimaryKey; AllBooks.Delete(); bool Found = AllBooks.ThisBook.Find(PrimaryKey); Assert.IsFalse(Found); }