public void Patron_Checkout_ChecksoutABook() { Patron firstPatron = new Patron("Mayor McCheese"); firstPatron.Save(); Book newBook = new Book("Cats", testDate, 2); newBook.Save(); newBook.StockBook(); firstPatron.CheckoutBook(newBook.GetCopies()[0].GetId(), testDate2); List<Copy> result = firstPatron.GetCheckOutRecord(false); List<Copy> expectedResult = newBook.GetCopies(); Assert.Equal(expectedResult, result); }
public void Patron_ReturnBook_ReturnsCheckedoutBook() { Patron firstPatron = new Patron("Mayor McCheese"); firstPatron.Save(); Book newBook = new Book("Cats", testDate, 2); newBook.Save(); newBook.StockBook(); firstPatron.CheckoutBook(newBook.GetCopies()[0].GetId(), testDate2); firstPatron.ReturnBook(newBook.GetCopies()[0].GetId()); int result = firstPatron.GetCheckOutRecord(false).Count; Assert.Equal(0, result); }
public void Patron_GetCheckoutHistory_ReturnsCheckOutHistory() { Patron firstPatron = new Patron("Mayor McCheese"); firstPatron.Save(); Book firstBook = new Book("Cats", testDate, 2); firstBook.Save(); firstBook.StockBook(); Book secondBook = new Book("Dogs", testDate, 2); secondBook.Save(); secondBook.StockBook(); firstPatron.CheckoutBook(firstBook.GetCopies()[0].GetId(), testDate2); firstPatron.CheckoutBook(secondBook.GetCopies()[0].GetId(), testDate2); firstPatron.ReturnBook(firstBook.GetCopies()[0].GetId()); Copy result = firstPatron.GetCheckOutRecord(true)[0]; Copy expectedResult = firstBook.GetCopies()[0]; Assert.Equal(expectedResult, result); }