У меня есть следующие интерфейсы.Я не уверен, как я могу использовать Moq для макетирования IRepository из-за того, что T является универсальным.Я уверен, что есть способ, но я ничего не нашел через поиск здесь или в Google.Кто-нибудь знает, как мне этого добиться?
Я довольно новичок в Moq, но вижу преимущество в том, что потратил время на его изучение.
/// <summary>
/// This is a marker interface that indicates that an
/// Entity is an Aggregate Root.
/// </summary>
public interface IAggregateRoot
{
}
/// <summary>
/// Contract for Repositories. Entities that have repositories
/// must be of type IAggregateRoot as only aggregate roots
/// should have a repository in DDD.
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IRepository<T> where T : IAggregateRoot
{
T FindBy(int id);
IList<T> FindAll();
void Add(T item);
void Remove(T item);
void Remove(int id);
void Update(T item);
void Commit();
void RollbackAllChanges();
}