예제 #1
0
        public void ReserveTest()
        {
            bool success         = false;
            var  adminController = new AdminPresenter();
            var  bookController  = new BookPresenter();

            var successfullAdd = adminController.AddBook(reservationBook);

            bookController.Reserve(reservationBook.SerialNumber, user.Username);
            var book = bookRepository.GetByID(reservationBook.SerialNumber);

            if (book.Status.Equals("Reserved"))
            {
                success = true;
            }
            var successfulDelete = adminController.RemoveBook(reservationBook);

            Assert.IsTrue(success);
        }
예제 #2
0
        private void ReserveBtn_Click(object sender, EventArgs e)
        {
            int bookId       = 0;
            var selectedItem = BookCatalogLV.SelectedItems;

            if (selectedItem.Count == 1)
            {
                bookId = Convert.ToInt32(selectedItem[0].SubItems[0].Text);
            }
            var success = _bookPresenter.Reserve(bookId, _username);

            if (success)
            {
                MessageBox.Show("Book successfully loaned");
            }
            else
            {
                MessageBox.Show("Book has been borrowed or reserved!");
            }
        }