public Library CheckInBook(Book b, DateTime returndate) { //var result = libraries.FirstOrDefault(x => x.Book.Id == b.Id && x.ExpectedReturnDate != null); var result = new Library(); result.ExpectedReturnDate = null; result.ActualReturnDate = returndate; return result; }
public void CheckForCheckIn() { LibraryManager mgr = new LibraryManager(); var book = new Book(); var library = mgr.CheckInBook(book, DateTime.Parse("10/7/2015")); //mgr.AddBookToList(book); Assert.AreEqual(DateTime.Parse("10/7/2015"), library.ActualReturnDate); Assert.IsNull(library.ExpectedReturnDate); }
public void CheckForCheckOut() { var book = new Book(); var student = new Student(); LibraryManager mgr = new LibraryManager(); var library = mgr.CheckOutBook(book, student, DateTime.Parse("9/05/2004")); List<Library> libraries = new List<Library>(); Assert.AreEqual(DateTime.Parse("9/05/2004"), library.BorrowDate); Assert.AreEqual(DateTime.Parse("10/05/2004"), library.ExpectedReturnDate); }
public Library CheckOutBook(Book b, Student s, DateTime borrowdate) { var result = new Library(); //if (libraries.Any()) //{ // result.Id = libraries.Max(x => x.Id) + 1; //} //else //{ // result.Id = 1; //} //result.Book = b; //result.Student = s; result.BorrowDate = borrowdate; result.ExpectedReturnDate = borrowdate.AddMonths(1); //libraries.Add(result); return result; }
public void AddBookToList(Book b) { b.Id = books.Max(x => x.Id) + 1; books.Add(b); }