protected void DeleteBookButton_Click(Object sender, EventArgs e) { Button btn = (Button)sender; string bookID = btn.CommandArgument.ToString(); BooksLogic bl = new BooksLogic(); bool savedChanges = bl.DeleteBook(Convert.ToInt32(bookID)); if (savedChanges) { Response.Redirect("AdminBooks"); } }
public async Task DeleteBook_Sucessfully() { int bookId = 1; _mockMapper.Setup(m => m.Map <Book, DataModel.Book>(It.IsAny <Book>())).Returns(_bookDM); _mockBookRepo.Setup(x => x.DeleteBook(It.IsAny <int>())).ReturnsAsync(true); var response = await _bookLogic.DeleteBook(bookId); Assert.IsNotNull(response); Assert.AreEqual(response, true); }