public static void CheckOut(this ScanStation scanner, string barcode, int patronId, DateTime dateTime)
 {
     TimeService.NextTime = dateTime;
     scanner.AcceptLibraryCard(patronId);
     TimeService.NextTime = dateTime;
     scanner.AcceptBarcode(barcode);
 }
        public void CheckInAtSecondBranchResultsInTransfer()
        {
            var newBranchId    = scanner.BranchId + 1;
            var scannerBranch2 = new ScanStation(context, newBranchId, classificationService, holdingsService, patronsService);

            scannerBranch2.AcceptBarcode(SomeBarcode);

            Assert.Equal(newBranchId, holdingsService.FindByBarcode(SomeBarcode).BranchId);
        }
Exemple #3
0
            public void CheckInAtSecondBranchResultsInTransfer()
            {
                var newBranchId    = scanner.BranchId + 1;
                var scannerBranch2 = new ScanStation(newBranchId, classificationService.Object, holdingRepo, patronRepo);

                scannerBranch2.AcceptBarcode(SomeBarcode);

                Assert.That(GetByBarcode(SomeBarcode).BranchId, Is.EqualTo(newBranchId));
            }
        public void TransfersAreCheckinsToDifferentBranch()
        {
            CheckOut(barcode1);

            var scannerBranch2 = new ScanStation(Branch2Id, classificationService);

            scannerBranch2.AcceptBarcode(barcode1);

            var holding = holdingService.Retrieve(barcode1);

            Assert.That(holding.IsCheckedOut, Is.False);
            Assert.That(holding.BranchId, Is.EqualTo(Branch2Id));
        }
        public void CheckOutBook()
        {
            scanner.AddNewMaterial(Isbn1);

            TimeService.NextTime = CheckoutTime;
            scanner.AcceptLibraryCard(patronId1);
            scanner.AcceptBarcode(barcode1);
            scanner.CompleteCheckout();

            var holding = holdingService.Retrieve(barcode1);

            Assert.That(holding.HeldByPatronId, Is.EqualTo(patronId1));
            Assert.That(holding.CheckOutTimestamp, Is.EqualTo(CheckoutTime));

            var patron = new PatronService().Retrieve(patronId1);

            Assert.That(patron.Holdings, Is.EqualTo(new List <string> {
                barcode1
            }));
        }
        public void RescanBySamePatronIsIgnored()
        {
            scanner.AcceptBarcode(SomeBarcode);

            Assert.Equal(savedPatronId, holdingsService.FindByBarcode(SomeBarcode).HeldByPatronId);
        }
        public void ThrowsWhenCheckingInCheckedOutBookWithoutPatronScan()
        {
            scanner.ScanNewMaterial(SomeBarcode, classificationServiceMock);

            Assert.Throws <CheckoutException>(() => scanner.AcceptBarcode(SomeBarcode));
        }
 public static void CheckIn(this ScanStation scanner, string barcode, DateTime dateTime)
 {
     TimeService.NextTime = dateTime;
     scanner.AcceptBarcode(barcode);
 }