I have a asp.net core application that uses dependency injection defined in the startup.cs class of the application:
public void ConfigureServices(ISer
Although @Kritner's answer is correct, I prefer the following for code integrity and better DI experience:
[TestClass]
public class MatchRepositoryTests
{
private readonly IMatchRepository matchRepository;
public MatchRepositoryTests()
{
var services = new ServiceCollection();
services.AddTransient();
var serviceProvider = services.BuildServiceProvider();
matchRepository = serviceProvider.GetService();
}
}