public void GetById_Should_Call_UnitOfWork_And_Repository() { // Act _ = _productsProvider.GetById(Id); // Assert _unitOfWorkMock.Verify(x => x.Repository <ProductEntity>(), Times.Once()); _repositoryMock.Verify(x => x.GetAsNoTracking(), Times.Once()); }
public ActionResult <Product> GetById(int id) { try { return(_provider.GetById(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); } }