예제 #1
0
 internal Library CheckInBook(Book b, DateTime returndate)
 {
     var result = checkedOutBooks.FirstOrDefault(x => x.Book.Id == b.Id && x.ExpectedReturnDate != null);
     result.ExpectedReturnDate = null;
     result.ActualReturnDate = returndate;
     return result;
 }
예제 #2
0
 public void CheckedOoutBookDatesSetCorrectly()
 {
     var s = new Student();
     var b = new Book();
     var checkOutDate = DateTime.Parse("5/5/2000");
     LibraryManager mgr = new LibraryManager();
     Library result = mgr.CheckOutBook(b, s, checkOutDate);
     Assert.AreEqual(checkOutDate, result.BorrowDate);
     Assert.AreEqual(checkOutDate.AddMonths(1), result.ExpectedReturnDate);
 }
예제 #3
0
 public void CheckedInBookDatesSetCorrectly()
 {
     var s = new Student();
     var b = new Book();
     LibraryManager mgr = new LibraryManager();
     mgr.CheckOutBook(b, s, DateTime.Parse("5/5/2000"));
     Library result2 = mgr.CheckInBook(b, DateTime.Parse("5/9/2000"));
     Assert.AreEqual(DateTime.Parse("5/5/2000"), result2.BorrowDate);
     Assert.IsNull(result2.ExpectedReturnDate);
     Assert.AreEqual(DateTime.Parse("5/9/2000"), result2.ActualReturnDate);
 }
예제 #4
0
 public Library CheckOutBook(Book b, Student s, DateTime borrowdate)
 {
     var result = new Library();
     if (checkedOutBooks.Any())
     {
         result.Id = checkedOutBooks.Max(x => x.Id) + 1;
     }
     else
     {
         result.Id = 1;
     }
     result.Book = b;
     result.Student = s;
     result.BorrowDate = borrowdate;
     result.ExpectedReturnDate = borrowdate.AddMonths(1);
     checkedOutBooks.Add(result);
     return result;
 }
예제 #5
0
 internal Library CheckOutBook(Student s, Book b)
 {
     throw new NotImplementedException();
 }