public List <Book> GetCheckouts(List <Copy> copies) { List <Book> checkouts = new List <Book> { }; foreach (Copy Copy in copies) { Book newBook = Book.Find(Copy.GetBookId()); checkouts.Add(newBook); } return(checkouts); }
public void T6_Update_UpdatesCopyInDB() { Copy testCopy = new Copy(1); testCopy.Save(); int newBookId = 2; testCopy.Update(newBookId); int resultBookId = testCopy.GetBookId(); Assert.Equal(newBookId, resultBookId); }
public override bool Equals(System.Object otherCopy) { if (!(otherCopy is Copy)) { return(false); } else { Copy newCopy = (Copy)otherCopy; bool idEquality = (this.GetId() == newCopy.GetId()); bool bookIdEquality = (this.GetBookId() == newCopy.GetBookId()); bool availableEquality = (this.GetAvailability() == newCopy.GetAvailability()); return(idEquality && bookIdEquality && availableEquality); } }
public override bool Equals(System.Object otherCopy) { if (!(otherCopy is Copy)) { return(false); } else { Copy newCopy = (Copy)otherCopy; bool idEquality = this.GetId() == newCopy.GetId(); bool BookIdEquality = this.GetBookId() == newCopy.GetBookId(); return(idEquality && BookIdEquality); } }
public override bool Equals(System.Object otherCopy) { if (!(otherCopy is Copy)) { return(false); } else { Copy newCopy = (Copy)otherCopy; bool bookIdEquality = (this.GetBookId() == newCopy.GetBookId()); bool numberOfEquality = (this.GetNumberOf() == newCopy.GetNumberOf()); bool dueDateEquality = (this.GetDueDate() == newCopy.GetDueDate()); return(bookIdEquality && numberOfEquality && dueDateEquality); } }
public void AddCopy_OneCopy_PatronAndNewCopy() { Patron testPatron = new Patron("Britton"); testPatron.Save(); Copy newCopy = new Copy(1, 15); newCopy.Save(); testPatron.AddCopy(newCopy); List <Copy> allCopies = testPatron.GetCopy(); int checkedOut = allCopies[0].GetBookId(); int expected = newCopy.GetBookId(); Assert.Equal(expected, checkedOut); }