public void Delete_Should_Call_UnitOfWork_And_Repository()
        {
            // Act
            _productsProvider.Delete(Id);

            // Assert
            _unitOfWorkMock.Verify(x => x.Repository <ProductEntity>(), Times.Exactly(2));
            _repositoryMock.Verify(x => x.GetAsNoTracking(), Times.Once());
            _repositoryMock.Verify(x => x.Delete(It.Is <ProductEntity>(e => e == _entity)), Times.Once());
            _unitOfWorkMock.Verify(x => x.SaveChanges(), Times.Once());
        }
Exemplo n.º 2
0
        public ActionResult <bool> Delete(int id)
        {
            try
            {
                return(_provider.Delete(id));
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception during providing products, maybe DB is not fully initialized yet? " +
                                  $"Try again in a few minutes and if it doesn't help, check your docker-compose configuration.\n{e}");

                return(null);
            }
        }