public void LateCheckInResultsInFine()
        {
            scanner.CompleteCheckout();
            const int daysLate = 2;

            scanner.CheckIn(SomeBarcode, DaysPastDueDate(SomeBarcode, now, daysLate, classificationService));

            Assert.Equal(RetrievePolicy(SomeBarcode, classificationService).FineAmount(daysLate), patronsService.FindById(savedPatronId).Balance);
        }
コード例 #2
0
        public void PatronIdClearedWhenCheckoutCompleted()
        {
            scanner.AcceptLibraryCard(somePatronId);

            scanner.CompleteCheckout();

            Assert.Equal(ScanStation.NoPatron, scanner.CurrentPatronId);
        }
コード例 #3
0
        public ScanStation_WhenMaterialCheckedInTest(DbContextFixture fixture)
        {
            fixture.Seed();
            context         = new LibraryContext(fixture.ContextOptions);
            patronsService  = new PatronsService(context);
            holdingsService = new HoldingsService(context);

            classificationServiceMock = new Mock <IClassificationService>();
            classificationService     = classificationServiceMock.Object;

            somePatronId = patronsService.Create(new Patron {
                Name = "x"
            });

            scanner = new ScanStation(context, 1, classificationService, holdingsService, patronsService);

            scanner.ScanNewMaterial(SomeBarcode, classificationServiceMock);
            scanner.CheckOut(SomeBarcode, somePatronId, now);
            scanner.CompleteCheckout();
            scanner.CheckIn(SomeBarcode, now);
        }
コード例 #4
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
            }));
        }