public IEnumerable <TEntity> GetAll() { try { return(TourDatabaseContext.Set <TEntity>()); } catch (Exception ex) { throw new Exception($"Couldn't retrieve entities: {ex.Message}"); } }
public void GetAll_WhenExceptionOccurs_ThrowsException() { A.CallTo(() => _TourDatabaseContext.Set <Tour>()).Throws <Exception>(); _testeeFake.Invoking(x => x.GetAll()).Should().Throw <Exception>().WithMessage("Couldn't retrieve entities: Exception of type 'System.Exception' was thrown."); }