public void Delete_Removes_Correct_Book() { // Arrange buildBooks(); FilledBookRepository repo = new FilledBookRepository(starterBooks); starterBooks.RemoveAt(2); // Act repo.Remove(2); IEnumerable <Book> books = repo.GetAll(); // Asert Assert.Equal(starterBooks, books); }
public void Delete_Removes_Correct_Book() { // Arrange LibraryContextMock mockContext = new LibraryContextMock(); FilledBookRepository repo = new FilledBookRepository(mockContext); Book book1 = new Book { id = 0, title = "Tennis", isbn = "11111", author = "Andy Murray", publishDate = "01/01/2001" }; Book book2 = new Book { id = 1, title = "All about tennis", isbn = "22222", author = "Tim Henman", publishDate = "02/02/2002" }; Book book3 = new Book { id = 2, title = "Yeah tennis", isbn = "33333", author = "Boris Becker", publishDate = "03/03/2003" }; Book newBook1 = new Book() { id = 3, title = "Test1" }; Book newBook2 = new Book() { id = 4, title = "Test2" }; Book newBook3 = new Book() { id = 5, title = "Test3" }; repo.Add(newBook1); repo.Add(newBook2); repo.Add(newBook3); // Act repo.Remove(3); IEnumerable <Book> books = repo.GetAll(); // Asert Assert.Equal(new Book[] { book1, book2, book3, newBook2, newBook3 }, books.ToArray()); }