Esempio n. 1
0
        public async Task GetCustomerWishlistAsync_ShouldReturnNull_WhenCustomerDoesNotExist()
        {
            //Arrange
            _customerService.GetCustomerAsync(customerId).Returns(nullReturn);

            //Act
            var sut      = new WishlistService(_productRest, _customerService, _wishlistRepository);
            var products = await sut.GetCustomerWishlistAsync(customerId);

            //Assert
            Assert.Null(products);
        }
Esempio n. 2
0
        public async Task GetCustomerWishlistAsync_ShouldReturnList_WhenCustomerDoesExist()
        {
            //Arrange
            _customerService.GetCustomerAsync(customerId).Returns(existingCustomer);

            List <WishListProduct> list = new List <WishListProduct>();

            list.Add(new WishListProduct());

            _wishlistRepository.GetCustomerWishlistAsync(customerId).Returns(list);

            //Act
            var sut      = new WishlistService(_productRest, _customerService, _wishlistRepository);
            var products = await sut.GetCustomerWishlistAsync(customerId);

            //Assert
            Assert.NotNull(products);
            Assert.Single(products);
        }