public async Task DeleteWithIdAsyncTest_ValidId_HappyPath() { //arrange _access.WithDeleteWithIdResult(true); _sut = new WishlistRepository(_access.Object, _mapper.Object); //act var result = await _sut.DeleteAsync(WishlistBookTestUtils.GenerateValidWishlistBook().Id); //assert Assert.IsTrue(result); _access.Verify(m => m.DeleteWithIdAsync(It.IsAny <int>()), Times.Once); }
public async Task DeleteAsyncTest_NullWishlistBook_ThrowsNullReferenceException() { //arrange _access.WithDeleteWithIdResult(true); _sut = new WishlistRepository(_access.Object, _mapper.Object); //act var result = await _sut.DeleteAsync(null); //assert Assert.IsFalse(result); _access.Verify(m => m.DeleteOneAsync(It.IsAny <WishlistMap>()), Times.Never); }
public async Task DeleteAsyncTest_NegativeIdWishlistBook_ThrowsException() { //arrange var book = WishlistBookTestUtils.GenerateValidWishlistBook(); book.Id = -4; _access.WithDeleteWithIdResult(true); _sut = new WishlistRepository(_access.Object, _mapper.Object); //act var result = await _sut.DeleteAsync(book); //assert Assert.IsFalse(result); _access.Verify(m => m.DeleteWithIdAsync(It.IsAny <int>()), Times.Never); }