public void ClientPanel() { FillInterface fill = new FillLibrary(30); ILibrary library = new Library(); library.fillBooks(fill); UserPanel userPanel = new UserPanel(library); Client tomek = new Client(0, "tomek", "elo", "warszawa"); Book LOTR = new Book(31, "J.R.R", "LOTR", DateTime.Now); Book starwars = new Book(32, "J.L.", "Star wars", DateTime.Now); Book LOTR2 = new Book(33, "J.R.R2", "LOTR2", DateTime.Now); Book starwars2 = new Book(34, "J.K.", "Star wars2", DateTime.Now); WorkerPanel workerPanel = new WorkerPanel(library); workerPanel.addClient(tomek); workerPanel.addBook(LOTR); workerPanel.addBook(LOTR2); workerPanel.addBook(starwars); workerPanel.addBook(starwars2); Assert.AreEqual(true, userPanel.rentaBook(LOTR, tomek)); Assert.AreEqual(true, userPanel.rentaBook(LOTR2, tomek)); Assert.AreEqual(true, userPanel.rentaBook(starwars, tomek)); Assert.AreEqual(false, userPanel.rentaBook(starwars2, tomek)); Assert.AreEqual(true, userPanel.giveBackBook(LOTR, tomek)); Assert.AreEqual(false, userPanel.giveBackBook(LOTR, tomek)); }
public void LibraryBookMenagment() { FillInterface fill = new FillLibrary(30); ILibrary library = new Library(); library.fillBooks(fill); WorkerPanel workerPanel = new WorkerPanel(library); Book LOTR = new Book(31, "J.R.R", "LOTR", DateTime.Now); Book starwars = new Book(32, "J.L.", "Star wars", DateTime.Now); Assert.AreEqual(true, workerPanel.addBook(LOTR)); Assert.AreEqual(false, workerPanel.deleteBook(starwars)); Assert.AreEqual(true, workerPanel.deleteBook(LOTR)); workerPanel.showCurrentStateBooks(); }