public void SecondPatronCanCheckOutSecondCopyOfSameClassification()
        {
            var barcode1Copy2 = Holding.GenerateBarcode(Holding.ClassificationFromBarcode(SomeBarcode), 2);

            scanner.ScanNewMaterial(barcode1Copy2, classificationServiceMock);

            var patronId2 = patronsService.Create(new Patron {
                Name = ""
            });

            scanner.AcceptLibraryCard(patronId2);
            scanner.AcceptBarcode(barcode1Copy2);

            Assert.Equal(patronId2, holdingsService.FindByBarcode(barcode1Copy2).HeldByPatronId);
        }
 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);
 }
예제 #3
0
        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 PatronIdUpdatedWhenLibraryCardAccepted()
        {
            scanner.AcceptLibraryCard(somePatronId);

            Assert.Equal(somePatronId, scanner.CurrentPatronId);
        }