public AppFixture() { var services = new ServiceCollection(); services.AddScoped <IRepository, Repository>(); //Add Business Layer services.AddScoped <INodeBusiness, NodeBusiness>(); services.AddSingleton <IBackgroundWorker, BackgroundWorker>(); services.AddDbContext <ApplicationContext>(options => options.UseSqlServer(_connectionString)); serviceProvider = services.BuildServiceProvider(); var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope(); var context = serviceProvider.GetService <ApplicationContext>(); context.Database.Migrate(); context.Seed(); nodeBusiness = serviceProvider.GetRequiredService <INodeBusiness>(); }
public NodesController(INodeBusiness nodeBusiness) { _business = nodeBusiness; }