public void SwipeCard_WithValidBorrowerId_SetsBorrowerDetailsForBookScanner(
            IScanBookController scanBookController, IBorrowController borrowController,
            ICardReaderViewModel cardReaderViewModel, ICardReaderController cardReaderController,
            IScanBookViewModel scanBookViewModel)
        {
            AutoMapperConfig.RegisterMaps();

            // The borrow controller has been clicked.
            borrowController.WaitForCardSwipe();

            // The card is swiped with a known user.
            cardReaderViewModel.BorrowerId = "0001";

            // When the card is swiped.
            cardReaderController.CardSwiped(cardReaderViewModel.BorrowerId);

            scanBookViewModel.BorrowerId.Should().Be(1);
            scanBookViewModel.Name.Should().Be("fName1 lName1");
            scanBookViewModel.Contact.Should().Be("0001");
        }
        public void SwipeCard_WithValidBorrowerId_CardReaderIsDisabled(
            IScanBookController scanBookController
            , IBorrowController borrowController
            , ICardReaderController cardReaderController
            , ICardReaderViewModel cardReaderViewModel
            , IScanBookViewModel scanBookViewModel)
        {
            PreConditions(borrowController, cardReaderViewModel);

            // Arrange - unrestricted user.
            const string borrowerId = "1";
            cardReaderViewModel.BorrowerId = borrowerId;

            // Act - Swipe the card.
            cardReaderController.CardSwiped(borrowerId);

            // Assert - ensure that the card reader is disabled.
            cardReaderViewModel.Enabled.Should().BeFalse();
        }
        public void SwipeCard_WithValidBorrowerId_ExistingLoansDisplayed(
      IScanBookController scanBookController
      , IBorrowController borrowController
      , IBorrowingViewModel borrowingViewModel
      , ICardReaderController cardReaderController
      , ICardReaderViewModel cardReaderViewModel
      , IScanBookViewModel scanBookViewModel
      , IScannerController scannerController
      , IScannerViewModel scannerViewModel)
        {
            PreConditions(borrowController, cardReaderViewModel);

            // Arrange - User with existing loans.
            const string borrowerId = "2";
            cardReaderViewModel.BorrowerId = borrowerId;

            // Act - Swipe the card.
            cardReaderController.CardSwiped(borrowerId);
            

            // Assert - ensure that the card reader is disabled.
            scanBookViewModel.ExistingLoan.Should().Contain("author1");
            scanBookViewModel.ExistingLoan.Should().Contain("title2 ");
            scanBookViewModel.ExistingLoan.Should().Contain("fName2 lName2");
            scanBookViewModel.ExistingLoan.Should().Contain(DateTime.Today.ToShortDateString());
            scanBookViewModel.ExistingLoan.Should().Contain(DateTime.Today.AddDays(14).ToShortDateString());
        }