- Added ReadAsync method to IRepository for user retrieval. - Introduced _userRepo field in DbRepositoryTests for better clarity. - Modified Setup method to initialize _userRepo from the service provider. - Updated CreateAsync_ShouldNotThrow to use _userRepo. - Added ReadAsync_ShouldReturnCreated test for user retrieval validation.
22 lines
951 B
C#
22 lines
951 B
C#
using System.Linq.Expressions;
|
|
|
|
namespace DigitalData.Core.Abstractions.Infrastructure;
|
|
|
|
public interface IRepository<TEntity>
|
|
{
|
|
public Task<TEntity> CreateAsync(TEntity entity, CancellationToken ct = default);
|
|
|
|
public Task<IEnumerable<TEntity>> CreateAsync(IEnumerable<TEntity> entities, CancellationToken ct = default);
|
|
|
|
public Task<TEntity> CreateAsync<TDto>(TDto dto, CancellationToken ct = default);
|
|
|
|
public Task<IEnumerable<TEntity>> CreateAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken ct = default);
|
|
|
|
public Task<IEnumerable<TEntity>> ReadAsync(Expression<Func<TEntity, bool>>? expression = null, CancellationToken ct = default);
|
|
|
|
public Task UpdateAsync<TDto>(TDto dto, Expression<Func<TEntity, bool>> expression, CancellationToken ct = default);
|
|
|
|
public Task DeleteAsync<TDto>(Expression<Func<TEntity, bool>> expression, CancellationToken ct = default);
|
|
Task ReadAsync(Core.Tests.Mock.User user);
|
|
}
|