'How to inject a specific implementation in asp.net core

I have a Repository which has a dependency of User

I need to put other implementation of User and I can do it like that, but with this approach I do not know how to mock my repository

private readonly IRepository<Entity> _repository;

public SomeClass(MyAppDbContext context)
{
  _repository= new EfRepository<WorkOrder>(context, new User());
}

Is there a way to inject a specific implementation of User here, or how I can test the code I wrote



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source