public void Setup() { //setup our DI var serviceProvider = new ServiceCollection() .AddLogging() .AddSingleton <ITollRepository, TollRepository>() .AddTransient <ITollService, TollService>() .BuildServiceProvider(); //configure console logging serviceProvider .GetService <ILoggerFactory>(); _tollService = serviceProvider.GetService <ITollService>(); _tollRepository = serviceProvider.GetService <ITollRepository>(); }
public TollService(ITollRepository tollRepository) { _tollRepository = tollRepository; }