コード例 #1
0
        public void SwipeBorrowerCardShowsCurrentLoans()
        {
            var borrowDate = DateTime.Today;
            var dueDate    = DateTime.Today.AddDays(7);

            var member = _memberDao.AddMember("Jim", "Tulip", "Phone", "Email");

            var book = _bookDao.AddBook("Jim Tulip", "Adventures in Programming", "call number");

            var loan = _loanDao.CreateLoan(member, book, borrowDate, dueDate);

            _loanDao.CommitLoan(loan);

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            ctrl.initialise();

            //Test pre-conditions
            Assert.True(ctrl._reader.Enabled);
            Assert.Equal(ctrl, ctrl._reader.Listener);
            Assert.NotNull(ctrl._memberDAO);
            Assert.Equal(EBorrowState.INITIALIZED, ctrl._state);

            ctrl.cardSwiped(member.ID);

            foreach (var l in member.Loans)
            {
                borrowctrl.Received().DisplayExistingLoan(l.ToString());
            }
        }
コード例 #2
0
        public void ScanBooksBookScanCountLessThanLoanLimit()
        {
            var member = _memberDao.AddMember("Jim", "Tulip", "Phone", "Email");

            var book = _bookDao.AddBook("Jim Tulip", "Adventures in Programming", "call number");

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            InitialiseToScanBookPreConditions(ctrl, member);

            ctrl.bookScanned(book.ID);

            borrowctrl.Received().DisplayScannedBookDetails(book.ToString());

            Assert.Equal(1, ctrl.scanCount);
            Assert.NotNull(ctrl._loanList);
            Assert.NotEmpty(ctrl._loanList);
            Assert.Equal(1, ctrl._loanList.Count);

            borrowctrl.Received().DisplayPendingLoan(ctrl._loanList[0].ToString());

            Assert.NotNull(ctrl._bookList);
            Assert.NotEmpty(ctrl._bookList);
            Assert.Equal(1, ctrl._bookList.Count);

            Assert.Equal(book, ctrl._bookList[0]);

            Assert.Equal(EBorrowState.SCANNING_BOOKS, ctrl._state);
        }
コード例 #3
0
        public void SwipeBorrowerCardShowErrorIfMemberHasReachedFinesLimit()
        {
            var borrowDate = DateTime.Today;
            var dueDate    = DateTime.Today.AddDays(7);

            var member = _memberDao.AddMember("Jim", "Tulip", "Phone", "Email");

            var book = _bookDao.AddBook("Jim Tulip", "Adventures in Programming", "call number");

            var loan = _loanDao.CreateLoan(member, book, borrowDate, dueDate);

            _loanDao.CommitLoan(loan);

            member.AddFine(BookConstants.FINE_LIMIT + 1.00f);

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test calls being made
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            ctrl.initialise();

            //Test pre-conditions
            Assert.True(ctrl._reader.Enabled);
            Assert.Equal(ctrl, ctrl._reader.Listener);
            Assert.NotNull(ctrl._memberDAO);
            Assert.Equal(EBorrowState.INITIALIZED, ctrl._state);

            ctrl.cardSwiped(member.ID);

            borrowctrl.Received().DisplayOverFineLimitMessage(member.FineAmount);
        }
コード例 #4
0
        public void ScanBooksBookAlreadyScanned()
        {
            var member = CreateMockIMember();

            var book = Substitute.For <IBook>();

            book.State.Returns(BookState.AVAILABLE);

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            InitialiseToScanBookPreConditions(ctrl, member);

            _bookDao.GetBookByID(0).Returns(book);

            ctrl._bookList.Add(book); // Add the book to the booklist.

            ctrl.bookScanned(0);

            _bookDao.Received().GetBookByID(0);

            borrowctrl.Received().DisplayErrorMessage("Book has already been scanned");

            Assert.Equal(EBorrowState.SCANNING_BOOKS, ctrl._state);
        }
コード例 #5
0
 public void borrowBook()
 {
     BorrowController borrowController = new BorrowController(_display, _reader, _scanner, _printer,
                                                              _bookDAO, _loanDAO, _memberDAO);
     borrowController.initialise();
     throw new ApplicationException("Test Exception");
 }
コード例 #6
0
        public void AddAddressTestPage()
        {
            var controller = new BorrowController(new MockBorrowDal(), new MockMediaDal(), new MockMemberDal());
            var result     = (PartialViewResult)controller.AddAddress();

            Assert.AreEqual("AddAddress", result.ViewName);
        }
コード例 #7
0
        public void CanConfirmLoans()
        {
            var member = _memberDao.AddMember("Jim", "Tulip", "Phone", "Email");

            var book = _bookDao.AddBook("Jim Tulip", "Adventures in Programming", "call number");

            var loan = _loanDao.CreateLoan(member, book, DateTime.Today, DateTime.Today.AddDays(7));

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            ctrl.initialise();

            // Set Pre-conditions
            ctrl._state = EBorrowState.CONFIRMING_LOANS;
            ctrl._loanList.Add(loan);

            Assert.NotNull(ctrl);
            Assert.NotEmpty(ctrl._loanList);
            Assert.Equal(EBorrowState.CONFIRMING_LOANS, ctrl._state);

            ctrl.loansConfirmed();

            Assert.Equal(LoanState.CURRENT, loan.State);
            Assert.Equal(loan.ToString() + "\n\n", ((Printer)_printer).printBox.Text);

            Assert.True(!_reader.Enabled);
            Assert.True(!_scanner.Enabled);
            Assert.Equal(EBorrowState.COMPLETED, ctrl._state);
        }
コード例 #8
0
        public void CanConfirmLoans()
        {
            var loan = Substitute.For <ILoan>();

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            ctrl.initialise();

            // Set Pre-conditions
            ctrl._state = EBorrowState.CONFIRMING_LOANS;
            ctrl._loanList.Add(loan);
            ctrl._loanList.Add(loan);

            Assert.NotNull(ctrl);
            Assert.NotEmpty(ctrl._loanList);
            Assert.Equal(EBorrowState.CONFIRMING_LOANS, ctrl._state);

            ctrl.loansConfirmed();

            _loanDao.Received(2).CommitLoan(loan);

            _printer.Received(2).print(loan.ToString());

            Assert.True(!_reader.Enabled);
            Assert.True(!_scanner.Enabled);
            Assert.Equal(EBorrowState.COMPLETED, ctrl._state);
        }
コード例 #9
0
        public void SwipeBorrowerCardShowErrorIfMemberHasReachedFinesLimit()
        {
            var member = CreateMockIMember();

            member.HasReachedFineLimit.Returns(true);
            member.FineAmount.Returns(100.00f);

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            ctrl.initialise();

            //Test pre-conditions
            Assert.True(ctrl._reader.Enabled);
            Assert.Equal(ctrl, ctrl._reader.Listener);
            Assert.NotNull(ctrl._memberDAO);
            Assert.Equal(EBorrowState.INITIALIZED, ctrl._state);

            _memberDao.GetMemberByID(member.ID).Returns(member);

            ctrl.cardSwiped(member.ID);

            _memberDao.Received().GetMemberByID(member.ID);

            borrowctrl.Received().DisplayOverFineLimitMessage(member.FineAmount);
        }
コード例 #10
0
        public void SwipeBorrowerCardMemberDoesntExist()
        {
            var memberId = 1;

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            ctrl.initialise();

            //Test pre-conditions
            Assert.True(ctrl._reader.Enabled);
            Assert.Equal(ctrl, ctrl._reader.Listener);
            Assert.NotNull(ctrl._memberDAO);
            Assert.Equal(EBorrowState.INITIALIZED, ctrl._state);

            _memberDao.GetMemberByID(memberId).Returns((Member)null);

            ctrl.cardSwiped(memberId);

            _memberDao.Received().GetMemberByID(memberId);

            // Test using mocks that it received a Borrower not found error.
            borrowctrl.Received().DisplayErrorMessage("Borrower was not found in database");
        }
コード例 #11
0
        public void ScanBooksBookNotAvailable()
        {
            var member = CreateMockIMember();

            var book = Substitute.For <IBook>();

            book.State.Returns(BookState.DISPOSED);

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            InitialiseToScanBookPreConditions(ctrl, member);

            _bookDao.GetBookByID(0).Returns(book);

            ctrl.bookScanned(0);

            _bookDao.Received().GetBookByID(0);

            borrowctrl.Received().DisplayErrorMessage("Book is not available to be borrowed");

            Assert.Equal(EBorrowState.SCANNING_BOOKS, ctrl._state);
        }
コード例 #12
0
        public void ScanBooksBookScanCountLessThanLoanLimitClearsPreviousError()
        {
            var member = CreateMockIMember();

            var book = Substitute.For <IBook>();

            book.State.Returns(BookState.AVAILABLE);

            var borrowDate = DateTime.Today;
            var dueDate    = DateTime.Today.AddDays(7);

            var loan = Substitute.For <Loan>(book, member, borrowDate, dueDate);

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            // Set the UI to the mock so we can test
            var borrowctrl = Substitute.For <ABorrowControl>();

            ctrl._ui = borrowctrl;

            InitialiseToScanBookPreConditions(ctrl, member);

            _bookDao.GetBookByID(0).Returns(book);
            _loanDao.CreateLoan(member, book, borrowDate, dueDate).Returns(loan);

            ctrl.bookScanned(0);

            // Expect the error message to be cleared
            borrowctrl.Received().DisplayErrorMessage("");
        }
コード例 #13
0
        public void RunBookAlreadyScanned()
        {
            // Some test data initialisation
            var borrowDate = DateTime.Today;
            var dueDate    = DateTime.Today.AddDays(7);

            var member = _memberDao.AddMember("Jim", "Tulip", "Phone", "Email");

            var existingBook = _bookDao.AddBook("Jim Tulip", "Adventures in Programming", "call number");

            var existingLoan = _loanDao.CreateLoan(member, existingBook, borrowDate, dueDate);

            _loanDao.CommitLoan(existingLoan);

            var book = _bookDao.AddBook("Jim Tulip", "Adventures in Programming 2", "call number");

            // Set up
            var controller = new BorrowController(_display, _reader, _scanner, _printer,
                                                  _bookDao, _loanDao, _memberDao);

            controller.initialise();
            controller.cardSwiped(member.ID);

            controller._bookList.Add(book);

            // Test Pre-conditions
            Assert.True(_display.Display.IsEnabled);

            var borrowCtrl   = ((BorrowControl)_display.Display);
            var scanBookCtrl = borrowCtrl._controlDict.Single(c => c.Value is ScanBookControl).Value as ScanBookControl;

            Assert.NotNull(scanBookCtrl);
            Assert.True(scanBookCtrl.IsEnabled);
            Assert.True(scanBookCtrl.cancelButton.IsEnabled);
            Assert.True(scanBookCtrl.completeButton.IsEnabled);

            Assert.True(!_reader.Enabled);
            Assert.True(_scanner.Enabled);
            Assert.Equal(controller, _scanner.Listener);

            Assert.Equal(member.Loans.Count, controller.scanCount);
            Assert.Equal(member, controller._borrower);
            Assert.Equal(EBorrowState.SCANNING_BOOKS, controller._state);

            // Run use case
            controller.bookScanned(book.ID);

            // Test Post-conditions
            Assert.True(scanBookCtrl.IsEnabled);
            Assert.True(scanBookCtrl.cancelButton.IsEnabled);
            Assert.True(scanBookCtrl.completeButton.IsEnabled);

            Assert.True(!_reader.Enabled);
            Assert.True(_scanner.Enabled);

            Assert.Equal("Book has already been scanned", scanBookCtrl.errorMessage.Content);

            Assert.Equal(EBorrowState.SCANNING_BOOKS, controller._state);
        }
コード例 #14
0
        public void InitialiseControllerSetsStateToInitialized()
        {
            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            ctrl.initialise();

            Assert.Equal(EBorrowState.INITIALIZED, ctrl._state);
        }
コード例 #15
0
        public void DefaultControllerTestWithNullSelected()
        {
            var controller = new BorrowController();

            BorrowController.SelectedCategory = null;
            BorrowController.SelectedType     = null;
            Assert.IsInstanceOfType(controller, typeof(BorrowController));
        }
コード例 #16
0
        public void RejectLoansControlNotConfirmingLoans()
        {
            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            var ex = Assert.Throws <InvalidOperationException>(() => { ctrl.loansRejected(); });

            Assert.Equal("Control state must be set to 'Confirming Loans'", ex.Message);
        }
コード例 #17
0
        public void CompleteScansControlNotScanningBooks()
        {
            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            var ex = Assert.Throws <InvalidOperationException>(() => { ctrl.scansCompleted(); });

            Assert.Equal("Control state must be set to 'Scanning Books'", ex.Message);
        }
コード例 #18
0
        public void InitialiseControllerDisablesScanner()
        {
            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            ctrl.initialise();

            Assert.True(!ctrl._scanner.Enabled);
        }
コード例 #19
0
        public void RunMemberExistsAndNotRestricted()
        {
            // Set up
            var controller = new BorrowController(_display, _reader, _scanner, _printer,
                                                  _bookDao, _loanDao, _memberDao);

            controller.initialise();

            // Some test data initialisation
            var borrowDate = DateTime.Today;
            var dueDate    = DateTime.Today.AddDays(7);

            var member = _memberDao.AddMember("Jim", "Tulip", "Phone", "Email");

            var book = _bookDao.AddBook("Jim Tulip", "Adventures in Programming", "call number");

            var loan = _loanDao.CreateLoan(member, book, borrowDate, dueDate);

            _loanDao.CommitLoan(loan);

            // Test Pre-conditions
            Assert.True(_display.Display.IsEnabled);

            var borrowCtrl   = ((BorrowControl)_display.Display);
            var swipeCtrl    = borrowCtrl._controlDict.Single(c => c.Value is SwipeCardControl).Value as SwipeCardControl;
            var scanBookCtrl = borrowCtrl._controlDict.Single(c => c.Value is ScanBookControl).Value as ScanBookControl;

            Assert.NotNull(swipeCtrl);
            Assert.True(swipeCtrl.IsEnabled);
            Assert.True(swipeCtrl.cancelButton.IsEnabled);

            Assert.True(_reader.Enabled);
            Assert.Equal(controller, _reader.Listener);
            Assert.NotNull(controller._memberDAO);
            Assert.Equal(EBorrowState.INITIALIZED, controller._state);

            // Run use case
            controller.cardSwiped(member.ID);

            // Test Post-conditions
            Assert.NotNull(scanBookCtrl);
            Assert.True(scanBookCtrl.IsEnabled);
            Assert.True(scanBookCtrl.cancelButton.IsEnabled);
            Assert.True(scanBookCtrl.completeButton.IsEnabled);

            Assert.True(!_reader.Enabled);
            Assert.True(_scanner.Enabled);

            Assert.Equal(member.ID, scanBookCtrl.idLabel.Content);
            Assert.Equal($"{member.FirstName} {member.LastName}", scanBookCtrl.nameLabel.Content.ToString());
            Assert.Equal(member.Loans[0].ToString(), scanBookCtrl.existingLoanBox.Text);  // Test one existing loan is present

            Assert.Equal(member.Loans.Count, controller.scanCount);
            Assert.Equal(member, controller._borrower);
            Assert.Equal(EBorrowState.SCANNING_BOOKS, controller._state);
        }
コード例 #20
0
        public void RunScenario()
        {
            var bookDao   = new BookDao(new BookHelper());
            var loanDao   = new LoanDao(new LoanHelper());
            var memberDao = new MemberDao(new MemberHelper());

            var display = new MainWindow();
            var reader  = new CardReader();
            var scanner = new Scanner();
            var printer = new Printer();

            var controller = new BorrowController(display, reader, scanner, printer,
                                                  bookDao, loanDao, memberDao);

            // Test pre-conditions
            Assert.NotNull(controller);

            Assert.NotNull(bookDao);
            Assert.NotNull(loanDao);
            Assert.NotNull(memberDao);
            Assert.NotNull(display);
            Assert.NotNull(reader);
            Assert.NotNull(scanner);
            Assert.NotNull(printer);

            Assert.Equal(controller._bookDAO, bookDao);
            Assert.Equal(controller._loanDAO, loanDao);
            Assert.Equal(controller._memberDAO, memberDao);
            Assert.Equal(controller._display, display);
            Assert.Equal(controller._reader, reader);
            Assert.Equal(controller._scanner, scanner);
            Assert.Equal(controller._printer, printer);

            Assert.Equal(controller._reader.Listener, controller);
            Assert.Equal(controller._scanner.Listener, controller);

            Assert.Equal(EBorrowState.CREATED, controller._state);

            // Run use case
            controller.initialise();

            // Test post-conditions
            // Borrow book UI Displayed
            Assert.True(display.Display.IsEnabled);

            var borrowCtrl = ((BorrowControl)display.Display);
            var swipeCtrl  = borrowCtrl._controlDict.Single(c => c.Value is SwipeCardControl).Value as SwipeCardControl;

            Assert.NotNull(swipeCtrl);
            Assert.True(swipeCtrl.IsEnabled);
            Assert.True(swipeCtrl.cancelButton.IsEnabled);

            Assert.True(reader.Enabled);
            Assert.True(!scanner.Enabled);
            Assert.Equal(EBorrowState.INITIALIZED, controller._state);
        }
コード例 #21
0
        public void SwipeBorrowerCardControlNotInitialized()
        {
            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            Assert.Equal(EBorrowState.CREATED, ctrl._state);

            var ex = Assert.Throws <InvalidOperationException>(() => { ctrl.cardSwiped(1); });

            Assert.Equal("Controls must be initialised before member's card is swiped", ex.Message);
        }
コード例 #22
0
        public void CreateControlBookControlAddedAsListenerToCardReaderAndScanner()
        {
            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            _reader.Received().Listener  = ctrl;
            _scanner.Received().Listener = ctrl;

            Assert.Equal(ctrl, _reader.Listener);
            Assert.Equal(ctrl, _scanner.Listener);
        }
コード例 #23
0
        public void ConfirmBorrowTestWithException()
        {
            var mediaDal = new MockMediaDal
            {
                ThrowError = true
            };
            var controller = new BorrowController(new MockBorrowDal(), mediaDal, new MockMemberDal());
            var result     = (RedirectToActionResult)controller.ConfirmBorrow(1);

            Assert.AreEqual("Browse", result.ActionName);
        }
コード例 #24
0
        public void LibrariansChoiceValid()
        {
            var mockMediaDal = new MockMediaDal
            {
                ThrowError = false
            };
            var controller = new BorrowController(new MockBorrowDal(), mockMediaDal, new MockMemberDal());
            var result     = (ViewResult)controller.LibrariansChoice();

            Assert.AreEqual("Browse", result.ViewName);
        }
コード例 #25
0
        public void AddAddressTestExceptionThrown()
        {
            var customerDal = new MockMemberDal()
            {
                ThrowError = true
            };
            var controller = new BorrowController(new MockBorrowDal(), new MockMediaDal(), customerDal);
            var result     = (ViewResult)controller.AddAddress(new Address());

            Assert.AreEqual("ConfirmBorrow", result.ViewName);
            Assert.AreEqual("Uh-oh something went wrong", result.ViewData["Error"]);
        }
コード例 #26
0
        public void LibrariansChoiceWithException()
        {
            var mockMediaDal = new MockMediaDal
            {
                ThrowError = true
            };
            var controller = new BorrowController(new MockBorrowDal(), mockMediaDal, new MockMemberDal());
            var result     = (ViewResult)controller.LibrariansChoice();

            Assert.AreEqual("Browse", result.ViewName);
            Assert.AreEqual("Uh-oh.. something went wrong", result.ViewData["Error"]);
        }
コード例 #27
0
        public void CanScanBook()
        {
            var member = _memberDao.AddMember("Jim", "Tulip", "Phone", "Email");

            var book = _bookDao.AddBook("Jim Tulip", "Adventures in Programming", "call number");

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            InitialiseToScanBookPreConditions(ctrl, member);

            ctrl.bookScanned(book.ID); // if we get this far we've worked.
        }
コード例 #28
0
        private void InitialiseToScanBookPreConditions(BorrowController ctrl, IMember member)
        {
            ctrl.initialise();

            ctrl.cardSwiped(member.ID);

            // Test Pre-conditions
            Assert.NotNull(ctrl);
            Assert.NotNull(ctrl._scanner);
            Assert.Equal(ctrl._scanner.Listener, ctrl);
            Assert.Equal(EBorrowState.SCANNING_BOOKS, ctrl._state);
        }
コード例 #29
0
        public void TypeFilterTestWithExceptionThrown()
        {
            var mediaDal = new MockMediaDal
            {
                ThrowError = true
            };
            var controller = new BorrowController(new MockBorrowDal(), mediaDal, new MockMemberDal());
            var result     = (ViewResult)controller.TypeFilter("Action");

            Assert.AreEqual("Browse", result.ViewName);
            Assert.AreEqual("Uh-oh something went wrong", result.ViewData["Error"]);
        }
コード例 #30
0
        public void CreateControlAssignsArgumentsToLocalProperties()
        {
            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            Assert.Equal(_display, ctrl._display);
            Assert.Equal(_reader, ctrl._reader);
            Assert.Equal(_scanner, ctrl._scanner);
            Assert.Equal(_printer, ctrl._printer);
            Assert.Equal(_bookDao, ctrl._bookDAO);
            Assert.Equal(_loanDao, ctrl._loanDAO);
            Assert.Equal(_memberDao, ctrl._memberDAO);
        }
コード例 #31
0
        public void CanScanBook()
        {
            var member = CreateMockIMember();

            var ctrl = new BorrowController(_display, _reader, _scanner, _printer, _bookDao, _loanDao, _memberDao);

            InitialiseToScanBookPreConditions(ctrl, member);

            // Make the bookDao return a successful read
            _bookDao.GetBookByID(0).Returns(Substitute.For <IBook>());

            ctrl.bookScanned(0); // if we get this far we've worked.
        }
コード例 #32
0
 public void borrowBook()
 {
     BorrowController borrowController = new BorrowController(_display, _reader, _scanner, _printer,
                                                              _bookDAO, _loanDAO, _memberDAO);
     borrowController.initialise();
 }