public void GivenAdd_WhenAddBook_ShouldReturnBooksListWithNewBook() { // Arrange Book bookToAdd = new Book { Name = "Herbert Schildt C#" }; var bookFileStorage = new BookFileStorage(_settings); // Act bookFileStorage.Add(bookToAdd); var books = bookFileStorage.GetAll(); // Assert books.Should().BeEquivalentTo(new List <Book> { new Book { Id = 1, Name = "The Lord of the Rings" }, new Book { Id = 2, Name = "Le Petit Prince" }, new Book { Id = 3, Name = "Harry Potter and the Philosopher's Stone" }, new Book { Id = 4, Name = "The Hobbit" }, new Book { Id = 5, Name = "Herbert Schildt C#" } }); }
public void GivenArchive_WhenArchiveExistBook_ShouldReturnBookListWithArchivedBook() { // Arrange Book book = new Book { Id = 1, Name = "The Lord of the Rings" }; var bookFileStorage = new BookFileStorage(_settings); // Act bookFileStorage.Archive(book); var result = bookFileStorage.GetAll(); // Assert result.Should().BeEquivalentTo(new List <Book> { new Book { Id = 1, Name = "The Lord of the Rings", IsArchive = true }, new Book { Id = 2, Name = "Le Petit Prince", IsArchive = false }, new Book { Id = 3, Name = "Harry Potter and the Philosopher's Stone", IsArchive = false }, new Book { Id = 4, Name = "The Hobbit", IsArchive = false } }); }
public void GivenGetAll_WhenBookExist_ShouldReturnBooksList() { // Arrange var bookFileStorage = new BookFileStorage(_settings); // Act var books = bookFileStorage.GetAll(); // Assert books.Should().BeEquivalentTo(new List <Book> { new Book { Id = 1, Name = "The Lord of the Rings" }, new Book { Id = 2, Name = "Le Petit Prince" }, new Book { Id = 3, Name = "Harry Potter and the Philosopher's Stone" }, new Book { Id = 4, Name = "The Hobbit" }, }); }
public void GivenUpdate_WhenUpdateExistBook_ShouldReturnBookListWithUpdatedBook() { // Arrange Book bookToDelete = new Book { Id = 1, Name = "The Lord of the Rings" }; var bookFileStorage = new BookFileStorage(_settings); // Act bookFileStorage.Update(bookToDelete); var books = bookFileStorage.GetAll(); // Assert books.Should().BeEquivalentTo(new List <Book> { new Book { Id = 2, Name = "Le Petit Prince" }, new Book { Id = 3, Name = "Harry Potter and the Philosopher's Stone" }, new Book { Id = 4, Name = "The Hobbit" }, new Book { Id = 1, Name = "The Lord of the Rings" } }); }