public void UpdatePersistsChangedPatron() { var patron = new Patron { Name = "a" }; var id = service.Create(patron); patron.Name = "b"; service.Update(patron); Assert.Equal("b", service.FindById(id).Name); }
// 1/19/2017: who wrote this? // // FIXME. Fix this mess. We just have to SHIP IT for nwo!!! public void AcceptBarcode(string bc) { var cl = Holding.ClassificationFromBarcode(bc); var cn = Holding.CopyNumberFromBarcode(bc); var h = holdingsService.FindByBarcode(bc); if (h.IsCheckedOut) { if (cur == NoPatron) { // ci bc = h.Barcode; var patronId = h.HeldByPatronId; var cis = TimeService.Now; Material m = null; m = classificationService.Retrieve(h.Classification); var fine = m.CheckoutPolicy.FineAmount(h.CheckOutTimestamp.Value, cis); Patron p = patronsService.FindById(patronId); p.Fine(fine); patronsService.Update(p); h.CheckIn(cis, brId); holdingsService.Update(h); } else { if (h.HeldByPatronId != cur) // check out book already cked-out { var bc1 = h.Barcode; var n = TimeService.Now; var t = TimeService.Now.AddDays(21); var f = classificationService.Retrieve(h.Classification).CheckoutPolicy .FineAmount(h.CheckOutTimestamp.Value, n); var patron = patronsService.FindById(h.HeldByPatronId); patron.Fine(f); patronsService.Update(patron); h.CheckIn(n, brId); holdingsService.Update(h); // co h.CheckOut(n, cur, CheckoutPolicies.BookCheckoutPolicy); holdingsService.Update(h); // call check out controller(cur, bc1); t.AddDays(1); n = t; } else // not checking out book already cked out by other patron { // otherwise ignore, already checked out by this patron } } } else { if (cur != NoPatron) // check in book { h.CheckOut(cts, cur, CheckoutPolicies.BookCheckoutPolicy); holdingsService.Update(h); } else { throw new CheckoutException(); } } }