public async Task InsertOneAsyncTest_NullWishlistBookMap_ThrowsNullReferenceException() { //arrange _mapper.WithMap(null); _access.WithInsertResult(true); _sut = new WishlistRepository(_access.Object, _mapper.Object); //act var result = await _sut.InsertAsync(WishlistBookTestUtils.GenerateInvalidWishlistBook()); //assert Assert.IsFalse(result); _access.Verify(m => m.InsertOneAsync(It.IsAny <WishlistMap>()), Times.Never); }
public async Task InsertOneAsyncTest_ValidWishlistBook_Passes() { //arrange _mapper.WithMap(WishlistMapTestUtils.GenerateValidWishlistBookMap()); _access.WithInsertResult(true); _sut = new WishlistRepository(_access.Object, _mapper.Object); //act var result = await _sut.InsertAsync(WishlistBookTestUtils.GenerateValidWishlistBook()); //assert Assert.IsTrue(result); _access.Verify(m => m.InsertOneAsync(It.IsAny <WishlistMap>()), Times.Once); }