public void Create_WhenInvokedWithBook_ThenShouldAddNewBook() { // Arrange var catalog = new Catalog(); // Act catalog.Create(BookStub.Object); // Assert catalog.Retrieve(BookStub.Object.Isbn).ShouldBeEquivalentTo(BookStub.Object); }
public void Delete_WhenInvokedWithExistingIsbn_ThenShouldRemoveMatchingBookAndReturnTrue() { // Arrange var catalog = new Catalog(); catalog.Create(BookStub.Object); var book = catalog.Retrieve(BookStub.Object.Isbn); // Act var result = catalog.Delete(BookStub.Object.Isbn); // Assert catalog.RetrieveAll().Should().NotContain(book); result.Should().BeTrue(); }
public void Update_WhenInvokedWithExistingBook_ThenShouldUpdateMatchingBookAndReturnTrue() { // Arrange var catalog = new Catalog(); catalog.Create(BookStub.Object); var book = catalog.Retrieve(BookStub.Object.Isbn); // Act book.InStock = BookStub.Object.InStock = false; var result = catalog.Update(book); // Assert book.ShouldBeEquivalentTo(catalog.Retrieve(BookStub.Object.Isbn)); result.Should().BeTrue(); }
public void Retrieve_WhenInvokedWithExistingIsbn_ThenShouldReturnMatchingBook() { // Arrange var catalog = new Catalog(); catalog.Create(BookStub.Object); // Act var book = catalog.Retrieve(BookStub.Object.Isbn); // Assert book.ShouldBeEquivalentTo(BookStub.Object); }