public static void Main(string[] args) { var host = CreateWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; var logger = services.GetRequiredService <IAppLogger <StoreContext> >(); var configuration = services.GetRequiredService <IConfiguration>(); try { var userManager = services.GetRequiredService <UserManager <ApplicationUser> >(); AppIdentityDbContextSeed.SeedAsync(services, userManager).Wait(); var storeContext = services.GetRequiredService <StoreContext>(); //StoreContextSeed.SeedStoreAsync(storeContext, logger).Wait(); var sampleData = new TestSampleData(storeContext, configuration); } catch (Exception ex) { logger.Error(ex, "Error seeding database"); throw; } } host.Run(); }
public TestBase(ITestOutputHelper output) { _ServiceProvider = Services.BuildServiceProvider(); SeedIdentity(); _context = Resolve <StoreContext>(); _data = new TestSampleData(Resolve <StoreContext>(), Resolve <IConfiguration>()); NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration("NLog.config", false); _output = output; }