public void GetOverdue_Patron_AllDatesAndBookTitles() { Patron newPatron = new Patron("Britton"); newPatron.Save(); Book newBook1 = new Book("the book"); newBook1.Save(); Book newBook2 = new Book("the book2"); newBook2.Save(); Copy newCopy1 = new Copy(newBook1.GetId(), 15); newCopy1.Save(); Copy newCopy2 = new Copy(newBook2.GetId(), 15); newCopy2.Save(); newPatron.AddCopy(newCopy1); newPatron.AddCopy(newCopy2); List <string> expected = new List <string> { }; List <string> dueDates = newPatron.GetOverdue(); Assert.Equal(expected, dueDates); }
public void GetAvailableCopy_Book_BookAvailableCopies() { Book testBook1 = new Book("Alice in Wonderland"); testBook1.Save(); Copy newCopy1 = new Copy(testBook1.GetId(), 15); newCopy1.Save(); Copy newCopy2 = new Copy(testBook1.GetId(), 12); newCopy2.Save(); Patron testPatron = new Patron("Britton"); testPatron.Save(); testPatron.AddCopy(newCopy1); List <Copy> availableCopies = testBook1.GetAvailableCopy(); // int result = availableCopies[0].GetBookId(); List <Copy> expectedList = new List <Copy> { newCopy2 }; // int expected = expectedList[0].GetBookId(); Assert.Equal(expectedList, availableCopies); }
public void Test_AddCopy_AddAnCopyToAPatron() { Patron testPatron = new Patron ("Jane", "Doe", "555-555-5555"); testPatron.Save(); Copy newCopy = new Copy ("New", 1, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); newCopy.Save(); testPatron.AddCopy(newCopy); List<Copy> testCopy = new List<Copy> {newCopy}; List<Copy> allCopies = testPatron.GetCopies(); Assert.Equal(testCopy, allCopies); }
public void AddCopy_AddsCopyToPatron_True() { Patron testPatron = new Patron("Penny Flowers"); testPatron.Save(); Copy newCopy = new Copy(1, 5, DateTime.Today); newCopy.Save(); testPatron.AddCopy(newCopy); List <Copy> expected = new List <Copy> { newCopy }; List <Copy> result = testPatron.GetCopies(); Assert.Equal(expected, result); }
public void AddCopy_OneCopy_CopyNotAvailable() { Patron testPatron = new Patron("Britton"); testPatron.Save(); Copy newCopy = new Copy(1, 15); newCopy.Save(); testPatron.AddCopy(newCopy); int available = newCopy.GetAvailable(); Assert.Equal(0, available); }
public void CheckIn_OneCopy_PatronAndNewCopy() { Patron testPatron = new Patron("Britton"); testPatron.Save(); Copy newCopy = new Copy(1, 15); newCopy.Save(); testPatron.AddCopy(newCopy); testPatron.CheckIn(newCopy); List <Copy> allCopies = testPatron.GetCurrentCopy(); int checkedOut = allCopies.Count; Assert.Equal(0, checkedOut); }
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); }
public void T9_GetCopys_ReturnsAllPatronCopys() { Patron testPatron = new Patron("Barb"); testPatron.Save(); Copy testCopy1 = new Copy(5); testCopy1.Save(); Copy testCopy2 = new Copy(6); testCopy2.Save(); testPatron.AddCopy(testCopy1); List <Copy> result = testPatron.GetCopies(); List <Copy> testList = new List <Copy> { testCopy1 }; Assert.Equal(testList, result); }
public void T8_AddCopy_AddsCopyToPatron() { Book newBook = new Book("Freedom"); newBook.Save(); Copy testCopy = new Copy(newBook.GetId()); testCopy.Save(); Patron testPatron = new Patron("Barb"); testPatron.Save(); testPatron.AddCopy(testCopy); List <Copy> result = testPatron.GetCopies(); List <Copy> testList = new List <Copy> { testCopy }; Assert.Equal(testList, result); }
public void GetDueDate_Patron_oneDatesAndBookTitles() { Patron newPatron = new Patron("Britton"); newPatron.Save(); Book newBook = new Book("the book"); newBook.Save(); Copy newCopy = new Copy(newBook.GetId(), 15); newCopy.Save(); newPatron.AddCopy(newCopy); List <string> expected = new List <string> { "the book", "2017-03-02" }; List <string> dueDates = newPatron.GetDueDate(); Assert.Equal(expected, dueDates); }
public void AddCopy_OneCopy_CopyNotAvailable2() { Patron testPatron = new Patron("Britton"); testPatron.Save(); Patron testPatron2 = new Patron("dkjhfksjdhf"); testPatron2.Save(); Book newBook = new Book("super book"); Copy newCopy = new Copy(newBook.GetId(), 1); newCopy.Save(); testPatron.AddCopy(newCopy); testPatron2.AddCopy(newCopy); List <Copy> patroncopy = testPatron2.GetCopy(); List <Copy> expected = new List <Copy> { }; Assert.Equal(expected, patroncopy); }
public void T9_GetCopys_ReturnsAllPatronCopys() { Patron testPatron = new Patron("Barb"); testPatron.Save(); Copy testCopy1 = new Copy(5); testCopy1.Save(); Copy testCopy2 = new Copy(6); testCopy2.Save(); testPatron.AddCopy(testCopy1); List<Copy> result = testPatron.GetCopies(); List<Copy> testList= new List<Copy>{testCopy1}; Assert.Equal(testList,result); }
public void T8_AddCopy_AddsCopyToPatron() { Book newBook = new Book("Freedom"); newBook.Save(); Copy testCopy = new Copy(newBook.GetId()); testCopy.Save(); Patron testPatron = new Patron("Barb"); testPatron.Save(); testPatron.AddCopy(testCopy); List<Copy> result = testPatron.GetCopies(); List<Copy> testList = new List<Copy> {testCopy}; Assert.Equal(testList, result); }