public async Task RemoveProductFromCustomerrWishlistAsync_ShouldCallRepository_WhenCustomerDoesExist() { //Arrange string productId = "3"; _customerService.GetCustomerAsync(customerId).Returns(existingCustomer); _wishlistRepository.DeleteWishlistProductAsync(customerId, productId).Returns(true); var wishlistProduct = new WishListProduct() { Id = 1, ProductId = productId, Image = "http://images.luizalabs.com/123.png", Price = "30.00", Title = "Product123" }; _productRest.GetProductByIdAsync(productId).Returns(wishlistProduct); //Act var sut = new WishlistService(_productRest, _customerService, _wishlistRepository); var result = await sut.RemoveProductFromCustomerrWishlistAsync(customerId, productId); //Assert Assert.True(result); _ = _wishlistRepository .Received(1) .DeleteWishlistProductAsync(customerId, productId); }
public async Task RemoveProductFromCustomerrWishlistAsync_ShouldReturnNull_WhenCustomerDoesNotExist() { //Arrange _customerService.GetCustomerAsync(customerId).Returns(nullReturn); //Act var sut = new WishlistService(_productRest, _customerService, _wishlistRepository); var result = await sut.RemoveProductFromCustomerrWishlistAsync(customerId, "1"); //Assert Assert.False(result); }