コード例 #1
0
ファイル: ProfilePresenterTests.cs プロジェクト: nmotocic/LMS
        public void RenewLoanTest()
        {
            bool success         = false;
            var  adminController = new AdminPresenter();
            var  bookController  = new BookPresenter();
            var  successfullAdd  = adminController.AddBook(loanBook);

            bookController.Loan(loanBook.SerialNumber, user.Username);
            var loan = loanRepository.GetByBookId(loanBook.SerialNumber);
            var book = bookRepository.GetByID(loanBook.SerialNumber);

            if (book.Status.Equals("Unavaliable"))
            {
                var successfullLoanRenewal = adminController.RenewLoan(loan.Id);
                success = successfullLoanRenewal;
            }
            var successfulDelete = adminController.RemoveBook(loanBook);

            Assert.IsTrue(success);
        }
コード例 #2
0
        private void LoanBtn_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.Loan(bookId, _username);

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