Esempio n. 1
0
        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());
        }
Esempio n. 2
0
 public ScannerViewModel(IScannerController controller)
 {
     _controller = controller;
     ScanCommand = new DelegateCommand<string>(controller.Scanned).ObservesCanExecute(p => Enabled);
 }
Esempio n. 3
0
        public void SwipeCard_WithValidBorrowerId_ScannerIsEnabled(
         IScanBookController scanBookController
         , IBorrowController borrowController
         , ICardReaderController cardReaderController
         , ICardReaderViewModel cardReaderViewModel
         , IScanBookViewModel scanBookViewModel
         , IScannerController scannerController
         , IScannerViewModel scannerViewModel)
        {
            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.
            scannerViewModel.Enabled.Should().BeTrue();
        }