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); }
public void PatronIdClearedWhenCheckoutCompleted() { scanner.AcceptLibraryCard(somePatronId); scanner.CompleteCheckout(); Assert.Equal(ScanStation.NoPatron, scanner.CurrentPatronId); }
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); }
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 })); }