public void UpdateBookPenaltyCost() { Books book = new Books() { id = 108, author = "Jane Austin", title = "Awesome book", type = "Classic", penaltyCost = 20, state = 1 }; Assert.IsTrue(BookCRUD.addBook(book.id, book.title, book.author, book.type, book.penaltyCost, DateTime.Today, (int)book.state)); Assert.IsTrue(BookCRUD.updatePenaltyCost(book.id, 10)); book = BookCRUD.getBook(book.id); Assert.AreEqual(book.penaltyCost, 10); }
public void AddBookToDatabase() { Books book = new Books() { id = 103, author = "Jane Austin", title = "Awesome book", type = "Classic", penaltyCost = 20, state = 1 }; Assert.IsTrue(BookCRUD.addBook(book.id, book.title, book.author, book.type, book.penaltyCost, DateTime.Today, (int)book.state)); Assert.AreEqual(BookCRUD.getBook(book.id).penaltyCost, 20); Assert.AreEqual(BookCRUD.getBook(book.id).author, "Jane Austin"); Assert.AreEqual(BookCRUD.getBook(book.id).title, "Awesome book"); Assert.AreEqual(BookCRUD.getBook(book.id).type, "Classic"); Assert.AreEqual(BookCRUD.getBook(book.id).state, 1); }
public void BorrowExistingBookToCustomerWithMoney() { Books book = new Books() { id = 201, author = "Jane Austin", title = "Awesome book", type = "Classic", penaltyCost = 20, state = 1 }; Assert.IsTrue(BookCRUD.addBook(book.id, book.title, book.author, book.type, book.penaltyCost, DateTime.Today, (int)book.state)); Customers c = new Customers() { id = 201, name = "Paul", money = 100 }; Assert.IsTrue(CustomerCRUD.addCustomer(c.id, c.name, c.money)); Assert.IsTrue(BorrowedBookCRUD.borrowBook(101, c.id, book.id)); Assert.AreEqual(BookCRUD.getBook(book.id).returnDate, DateTime.Today.AddDays(14)); Assert.AreEqual(BorrowedBookCRUD.getBorrowedBooks(book.id).customerId, c.id); }