Exemplo n.º 1
0
        public void ScanBooksBookNotFound()
        {
            var member = CreateMockIMember();

            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((IBook)null);

            ctrl.bookScanned(0);

            _bookDao.Received().GetBookByID(0);

            borrowctrl.Received().DisplayErrorMessage("Book scanned was not found");

            Assert.Equal(EBorrowState.SCANNING_BOOKS, ctrl._state);
        }