public async Task AddBook_Sucessfully() { _mockMapper.Setup(m => m.Map <Book, DataModel.Book>(It.IsAny <Book>())).Returns(_bookDM); _mockBookRepo.Setup(x => x.AddBook(It.IsAny <DataModel.Book>(), It.IsAny <DataModel.BookStore>())).ReturnsAsync(true); var response = await _bookLogic.AddBook(_bookVM); Assert.IsNotNull(response); Assert.AreEqual(response, true); }
protected void SaveBookButton_Click(object sender, EventArgs e) { BooksLogic bl = new BooksLogic(); bool saveSuccess = bl.AddBook(ISBN.Text, BookTitle.Text, Category.SelectedValue, Author.SelectedValue, Publisher.Text, PublicationYear.Text, Price.Text); if (saveSuccess) { ReturnToSender(); } else { FailureText.Text = "Unable to add a new book to database."; ErrorMessage.Visible = true; } }