Adding guards and more tests (#68)

* Adding single entity by spec method to repository

* Adding guards and more unit tests
This commit is contained in:
Steve Smith
2017-10-30 11:53:29 -07:00
committed by GitHub
parent 3d46c80cff
commit b864be9265
10 changed files with 119 additions and 1 deletions

View File

@@ -26,6 +26,12 @@ namespace Infrastructure.Data
return _dbContext.Set<T>().Find(id);
}
public T GetSingleBySpec(ISpecification<T> spec)
{
return List(spec).FirstOrDefault();
}
public virtual async Task<T> GetByIdAsync(int id)
{
return await _dbContext.Set<T>().FindAsync(id);

View File

@@ -15,6 +15,7 @@ namespace Infrastructure.Logging
{
_logger.LogWarning(message, args);
}
public void LogInformation(string message, params object[] args)
{
_logger.LogInformation(message, args);