Ejemplo n.º 1
0
        public void AddBookTest()
        {
            var controller = new AdminPresenter();
            var success    = controller.AddBook(book);

            Assert.IsTrue(success);
        }
Ejemplo n.º 2
0
        private void addBtn_Click(object sender, EventArgs e)
        {
            Book book = new Book();

            book.SerialNumber     = Convert.ToInt32(serialNumTB.Text);
            book.Title            = titleTB.Text;
            book.Author           = authorTB.Text;
            book.Publisher        = publisherTB.Text;
            book.YearOfPublishing = Convert.ToInt32(yopTB.Text);
            book.Genre            = genreTB.Text;
            book.Status           = statusTB.Text;

            adminPresenter.AddBook(book);
            MessageBox.Show("Book successfully added!");

            Clear();
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        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);
        }